-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
213 additions
and
166 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,4 +5,7 @@ nodejs-api | |
# kakao login 파일을 ignore | ||
login.js | ||
|
||
.env | ||
.env | ||
|
||
config/database.js | ||
models/index.js |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// models/Concept.js | ||
const { DataTypes, Model } = require("sequelize"); | ||
|
||
class Concept extends Model { | ||
static init(sequelize) { | ||
return super.init( | ||
{ | ||
concept_id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
user_id: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
}, | ||
importance: { | ||
type: DataTypes.INTEGER, | ||
}, | ||
description: { | ||
type: DataTypes.STRING(300), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "Concept", | ||
tableName: "concept", | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
timestamps: false, // timestamps 옵션을 false로 설정 | ||
} | ||
); | ||
} | ||
|
||
static associate(models) { | ||
this.belongsTo(models.User, { foreignKey: "user_id" }); | ||
} | ||
} | ||
|
||
module.exports = Concept; |
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,43 @@ | ||
// models/Inquiry.js | ||
const { DataTypes, Model } = require("sequelize"); | ||
|
||
class Inquiry extends Model { | ||
static init(sequelize) { | ||
return super.init( | ||
{ | ||
inquiry_id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
user_id: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
}, | ||
title: { | ||
type: DataTypes.STRING(255), | ||
}, | ||
message: { | ||
type: DataTypes.TEXT, | ||
}, | ||
status: { | ||
type: DataTypes.STRING(50), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "Inquiry", | ||
tableName: "inquiry", | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
timestamps: false, // timestamps 옵션을 false로 설정 | ||
} | ||
); | ||
} | ||
|
||
static associate(models) { | ||
this.belongsTo(models.User, { foreignKey: "user_id" }); | ||
} | ||
} | ||
|
||
module.exports = Inquiry; |
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,43 @@ | ||
// models/Quiz.js | ||
const { DataTypes, Model } = require("sequelize"); | ||
|
||
class Quiz extends Model { | ||
static init(sequelize) { | ||
return super.init( | ||
{ | ||
quiz_id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
user_id: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
}, | ||
importance: { | ||
type: DataTypes.INTEGER, | ||
}, | ||
question: { | ||
type: DataTypes.STRING(300), | ||
}, | ||
description: { | ||
type: DataTypes.STRING(300), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "Quiz", | ||
tableName: "quiz", | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
timestamps: false, // timestamps 옵션을 false로 설정 | ||
} | ||
); | ||
} | ||
|
||
static associate(models) { | ||
this.belongsTo(models.User, { foreignKey: "user_id" }); | ||
} | ||
} | ||
|
||
module.exports = Quiz; |
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,43 @@ | ||
// models/User.js | ||
const { DataTypes, Model } = require("sequelize"); | ||
|
||
class User extends Model { | ||
static init(sequelize) { | ||
return super.init( | ||
{ | ||
id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
kakao_id: { | ||
type: DataTypes.BIGINT, | ||
allowNull: false, | ||
}, | ||
nickname: { | ||
type: DataTypes.STRING(50), | ||
}, | ||
image: { | ||
type: DataTypes.STRING(300), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "Useur", | ||
tableName: "user", | ||
charset: "utf8", // 추가: 문자 인코딩 설정 | ||
collate: "utf8_general_ci", // 추가: collate 설정 | ||
timestamps: false, // timestamps 옵션을 false로 설정 | ||
} | ||
); | ||
} | ||
|
||
static associate(models) { | ||
this.hasMany(models.Concept, { foreignKey: "user_id" }); | ||
this.hasMany(models.Quiz, { foreignKey: "user_id" }); | ||
this.hasMany(models.Wrong, { foreignKey: "user_id" }); | ||
this.hasMany(models.Inquiry, { foreignKey: "user_id" }); | ||
} | ||
} | ||
|
||
module.exports = User; |
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,40 @@ | ||
// models/Wrong.js | ||
const { DataTypes, Model } = require("sequelize"); | ||
|
||
class Wrong extends Model { | ||
static init(sequelize) { | ||
return super.init( | ||
{ | ||
wrong_id: { | ||
type: DataTypes.INTEGER, | ||
primaryKey: true, | ||
autoIncrement: true, | ||
}, | ||
user_id: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
}, | ||
importance: { | ||
type: DataTypes.INTEGER, | ||
}, | ||
description: { | ||
type: DataTypes.STRING(300), | ||
}, | ||
}, | ||
{ | ||
sequelize, | ||
modelName: "Wrong", | ||
tableName: "wrong", | ||
charset: "utf8", | ||
collate: "utf8_general_ci", | ||
timestamps: false, // timestamps 옵션을 false로 설정 | ||
} | ||
); | ||
} | ||
|
||
static associate(models) { | ||
this.belongsTo(models.User, { foreignKey: "user_id" }); | ||
} | ||
} | ||
|
||
module.exports = Wrong; |