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
butter-studio
Commits
619844f9
Commit
619844f9
authored
Jul 24, 2021
by
Jiwon Yoon
Browse files
Merge branch 'jiwon'
parents
3d810a85
2cb5ab29
Changes
4
Show whitespace changes
Inline
Side-by-side
server/db/index.js
View file @
619844f9
...
...
@@ -4,6 +4,8 @@ import RoleModel from "../models/role.model.js";
import
MovieModel
from
"
../models/movie.model.js
"
;
import
CinemaModel
from
"
../models/cinema.model.js
"
;
import
TheaterModel
from
"
../models/theater.model.js
"
;
import
TimeTableModel
from
'
../models/role.model.js
'
;
import
ReservationModel
from
'
../models/reservation.model.js
'
;
import
dbConfig
from
"
../config/db.config.js
"
;
const
sequelize
=
new
Sequelize
(
...
...
@@ -27,6 +29,8 @@ const Role = RoleModel(sequelize)
const
Movie
=
MovieModel
(
sequelize
)
const
Cinema
=
CinemaModel
(
sequelize
)
const
Theater
=
TheaterModel
(
sequelize
)
const
TimeTable
=
TimeTableModel
(
sequelize
)
const
Reservation
=
ReservationModel
(
sequelize
)
User
.
belongsTo
(
Role
);
Role
.
hasOne
(
User
);
...
...
@@ -40,5 +44,7 @@ export {
Role
,
Movie
,
Cinema
,
Theater
Theater
,
TimeTable
,
Reservation
}
\ No newline at end of file
server/index.js
View file @
619844f9
...
...
@@ -10,7 +10,7 @@ dotenv.config({
});
sequelize
.
sync
({
force
:
tru
e
})
.
sync
({
force
:
fals
e
})
.
then
(
async
()
=>
{
await
Promise
.
all
(
Object
.
keys
(
ROLE_NAME
).
map
((
name
)
=>
{
...
...
server/models/reservation.model.js
0 → 100644
View file @
619844f9
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
ReservationModel
=
(
sequelize
)
=>
{
const
Reservation
=
sequelize
.
define
(
"
reservation
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
movieId
:
{
type
:
DataTypes
.
INTEGER
,
},
theater
:
{
type
:
DataTypes
.
INTEGER
,
},
row
:
{
type
:
DataTypes
.
STRING
,
},
col
:
{
type
:
DataTypes
.
INTEGER
,
},
timetable
:{
type
:
DataTypes
.
INTEGER
,
},
user
:{
type
:
DataTypes
.
INTEGER
,
},
payment
:{
type
:
DataTypes
.
INTEGER
,
}
},
{
timestamps
:
true
,
freezeTableName
:
true
,
tableName
:
"
reservations
"
}
);
return
Reservation
;
};
export
default
ReservationModel
;
\ No newline at end of file
server/models/timetable.model.js
0 → 100644
View file @
619844f9
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
TimeTableModel
=
(
sequelize
)
=>
{
const
TimeTable
=
sequelize
.
define
(
"
timetable
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
theater
:
{
type
:
DataTypes
.
INTEGER
,
},
movieId
:
{
type
:
DataTypes
.
INTEGER
,
},
title
:
{
type
:
DataTypes
.
STRING
,
},
release_date
:
{
type
:
DataTypes
.
STRING
},
date
:
{
type
:
DataTypes
.
STRING
,
},
time
:
{
type
:
DataTypes
.
TIME
,
},
},
{
// timestamps: true,
freezeTableName
:
true
,
tableName
:
"
timetables
"
}
);
return
TimeTable
;
};
export
default
TimeTableModel
;
\ 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