Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
20930c8b
Commit
20930c8b
authored
Nov 02, 2021
by
Kim, Subin
Browse files
ku&schedule model 작성 및 적용
parent
74c9439e
Changes
4
Hide whitespace changes
Inline
Side-by-side
server/db/index.js
View file @
20930c8b
import
{
Sequelize
}
from
"
sequelize
"
import
{
Sequelize
}
from
"
sequelize
"
import
dbConfig
from
"
../config/db.config.js
"
import
dbConfig
from
"
../config/db.config.js
"
import
UserModel
from
"
../models/user.model.js
"
;
import
UserModel
from
"
../models/user.model.js
"
;
import
KUModel
from
"
../models/ku.model.js
"
;
import
ScheduleModel
from
"
../models/schedule.model.js
"
;
import
TodoModel
from
"
../models/todo.model.js
"
;
import
TodoModel
from
"
../models/todo.model.js
"
;
import
SubjectModel
from
"
../models/subject.model.js
"
;
import
SubjectModel
from
"
../models/subject.model.js
"
;
...
@@ -21,14 +23,19 @@ const sequelize = new Sequelize(
...
@@ -21,14 +23,19 @@ const sequelize = new Sequelize(
);
);
const
User
=
UserModel
(
sequelize
)
const
User
=
UserModel
(
sequelize
)
const
KU
=
KUModel
(
sequelize
)
const
Schedule
=
ScheduleModel
(
sequelize
)
const
Todo
=
TodoModel
(
sequelize
)
const
Todo
=
TodoModel
(
sequelize
)
const
Subject
=
SubjectModel
(
sequelize
)
const
Subject
=
SubjectModel
(
sequelize
)
Schedule
.
belongsTo
(
User
)
Subject
.
belongsTo
(
User
)
Subject
.
belongsTo
(
User
)
export
{
export
{
sequelize
,
sequelize
,
User
,
User
,
KU
,
Schedule
,
Todo
,
Todo
,
Subject
Subject
}
}
\ No newline at end of file
server/models/ku.model.js
0 → 100644
View file @
20930c8b
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
KUModel
=
(
sequelize
)
=>
{
const
KU
=
sequelize
.
define
(
"
ku
"
,
{
id
:
{
type
:
DataTypes
.
UUID
,
defaultValue
:
DataTypes
.
UUIDV4
,
primaryKey
:
true
},
title
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
},
start
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
},
end
:
{
type
:
DataTypes
.
DATE
},
memo
:
{
type
:
DataTypes
.
TEXT
}
},
{
timestamps
:
true
,
freezeTableName
:
true
}
)
return
KU
}
export
default
KUModel
\ No newline at end of file
server/models/schedule.model.js
0 → 100644
View file @
20930c8b
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
ScheduleModel
=
(
sequelize
)
=>
{
const
Schedule
=
sequelize
.
define
(
"
schedule
"
,
{
id
:
{
type
:
DataTypes
.
UUID
,
defaultValue
:
DataTypes
.
UUIDV4
,
primaryKey
:
true
},
title
:
{
type
:
DataTypes
.
STRING
,
allowNull
:
false
},
start
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
false
},
end
:
{
type
:
DataTypes
.
DATE
},
location
:
{
type
:
DataTypes
.
STRING
},
memo
:
{
type
:
DataTypes
.
TEXT
}
},
{
timestampts
:
true
,
}
)
return
Schedule
}
export
default
ScheduleModel
\ No newline at end of file
server/models/user.model.js
View file @
20930c8b
...
@@ -64,5 +64,4 @@ const UserModel = (sequelize) => {
...
@@ -64,5 +64,4 @@ const UserModel = (sequelize) => {
return
User
return
User
};
};
export
default
UserModel
;
export
default
UserModel
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment