forked from junbyeol/kaist-ua-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
287 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await Promise.all([ | ||
queryInterface.createTable("PostTag", { | ||
id: { | ||
type: Sequelize.UUID, | ||
defaultValue: Sequelize.UUIDV4, | ||
primaryKey: true, | ||
}, | ||
korName: Sequelize.TEXT, | ||
engName: Sequelize.TEXT, | ||
BoardId: { | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: "Board", // name of Source model | ||
key: "id", | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}, | ||
}), | ||
queryInterface.createTable("Post_PostTag", { | ||
PostId: { | ||
type: Sequelize.UUID, | ||
references: { | ||
model: "Post", // name of Target model | ||
key: "id", // key in Target model that we're referencing | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}, | ||
PostTagId: { | ||
type: Sequelize.UUID, | ||
references: { | ||
model: "PostTag", // name of Target model | ||
key: "id", // key in Target model that we're referencing | ||
}, | ||
onUpdate: "CASCADE", | ||
onDelete: "CASCADE", | ||
}, | ||
createdAt: Sequelize.DATE, | ||
updatedAt: Sequelize.DATE, | ||
}), | ||
]); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await Promise.all([ | ||
queryInterface.dropTable("Post_PostTag"), | ||
queryInterface.dropTable("PostTag"), | ||
]); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"use strict"; | ||
module.exports = (sequelize, DataTypes) => { | ||
const Admin = sequelize.define( | ||
"Admin", | ||
{ | ||
id: { | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
primaryKey: true, | ||
}, | ||
email: DataTypes.STRING, | ||
password: DataTypes.STRING, | ||
salt: DataTypes.STRING, | ||
}, | ||
{ | ||
freezeTableName: true, | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
} | ||
); | ||
Admin.associate = function (models) { | ||
// associations can be defined here | ||
}; | ||
return Admin; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
module.exports = (sequelize, DataTypes) => { | ||
const Banner = sequelize.define( | ||
"Banner", | ||
{ | ||
id: { | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
primaryKey: true, | ||
}, | ||
image: DataTypes.TEXT, | ||
link: DataTypes.TEXT, | ||
isActive: DataTypes.BOOLEAN, | ||
}, | ||
{ | ||
freezeTableName: true, | ||
timestamps: false, | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
} | ||
); | ||
Banner.associate = function (models) { | ||
// associations can be defined here | ||
}; | ||
return Banner; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
module.exports = (sequelize, DataTypes) => { | ||
const PostTag = sequelize.define( | ||
"PostTag", | ||
{ | ||
id: { | ||
type: DataTypes.UUID, | ||
defaultValue: DataTypes.UUIDV4, | ||
primaryKey: true, | ||
}, | ||
korName: DataTypes.TEXT, | ||
engName: DataTypes.TEXT, | ||
}, | ||
{ | ||
freezeTableName: true, | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
timestamps: false, | ||
} | ||
); | ||
PostTag.associate = function (models) { | ||
// associations can be defined here | ||
PostTag.belongsToMany(models.Post, { through: "Post_PostTag" }); | ||
PostTag.belongsTo(models.Board); | ||
}; | ||
return PostTag; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
|
||
const models = require("../models"); | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await models.Banner.bulkCreate( | ||
[ | ||
{ | ||
image: | ||
"https://kaistua-web.s3.ap-northeast-2.amazonaws.com/Banner_kaiwiki.png", | ||
link: "https://student.kaist.ac.kr/wiki", | ||
isActive: 1, | ||
}, | ||
{ | ||
image: | ||
"https://kaistua-web.s3.ap-northeast-2.amazonaws.com/Banner2.png", | ||
link: "https://student.kaist.ac.kr/web/user/studentFee", | ||
isActive: 1, | ||
}, | ||
], | ||
{} | ||
); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.bulkDelete("Banner", null, {}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
"use strict"; | ||
|
||
const models = require("../models"); | ||
|
||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await models.PostTag.bulkCreate( | ||
[ | ||
{ | ||
korName: "회장단", | ||
engName: "Presidency", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "협력국", | ||
engName: "Bureau of Internal Operations and Communications", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "복지국", | ||
engName: "Bureau of Welfare", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "정책국", | ||
engName: "Bureau of Policy", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "디자인정보팀", | ||
engName: "Bureau of Design & Information Technology", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "사무국", | ||
engName: "Bureau of General Affairs", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "국제사무국", | ||
engName: "Bureau of International Affairs", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "집행지원실", | ||
engName: "Executive Secretariat", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "문화기획국", | ||
engName: "Bureau of Cultural Events", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "회계팀", | ||
engName: "Bureau of Finance", | ||
BoardId: 1, | ||
}, | ||
{ | ||
korName: "식당", | ||
engName: "Restaurant", | ||
BoardId: 2, | ||
}, | ||
{ | ||
korName: "병원", | ||
engName: "Health", | ||
BoardId: 2, | ||
}, | ||
{ | ||
korName: "기타", | ||
engName: "Other", | ||
BoardId: 2, | ||
}, | ||
], | ||
{} | ||
); | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
await queryInterface.bulkDelete("Banner", null, {}); | ||
}, | ||
}; |
Oops, something went wrong.