-
Notifications
You must be signed in to change notification settings - Fork 4
/
startMsg.js
75 lines (62 loc) · 1.87 KB
/
startMsg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const { Post, StartMessage } = require('./src/sequelize/models');
const sequelize = require('sequelize');
const scheduller = require('./src/layers/exceptModels/form/scheduller');
// scheduller.totalLikeCount;
// scheduller.likeCountInit;
// scheduller.updateGrade;
// scheduller.deleteNotice;
// scheduller.createHotPost;
const Op = sequelize.Op;
const fs = require('fs');
const startMsg = fs.readFileSync('startMsg.txt', 'utf8').split(`\n`);
console.log(startMsg.length);
for (let i = 0; i < startMsg.length; i++) {
StartMessage.create({ message: startMsg[i] });
}
// for (let i = 0; i < 10; i++) {
// const random = Math.random() * 100;
// console.log(`${i}번째 내용`, startMsg[Math.floor(random)]);
// }
// let today = new Date();
// let yesterDay = new Date(new Date() - 24 * 60 * 60 * 1000);
// // today.setDate(today.getDate() - 1);
// console.log(today);
// console.log(yesterDay);
// const to =
// yesterDay.getFullYear() +
// '-' +
// String(yesterDay.getMonth() + 1).padStart(2, '0') +
// '-' +
// String(yesterDay.getDate()).padStart(2, '0');
// console.log(today < yesterDay);
// Post.count({
// where: {
// createdAt: {
// [Op.lt]: today,
// [Op.gt]: yesterDay
// }
// },
// raw: true
// }).then((data) => {
// console.log(data);
// // console.log(new Date(data[0].createdAt.split(' ')[0]));
// });
// Post.findAll({
// where: {}
// });
// let status = true;
// status = !status;
// status = !status;
// console.log(status);
// const data = [
// { name: '권영', createdAt: 0911 },
// { name: '수민', createdAt: 0910 },
// { name: '수범', createdAt: 0909 }
// ];
// const calcurateCreatedAt = (createdAt) => {
// return createdAt + 10;
// };
// for (let gwonyeong of data) {
// gwonyeong.createdAt = calcurateCreatedAt(At.createdAt);
// }
// console.log(data);