Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
schedules-legacy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
schedules-legacy
Commits
0466dfb5
Commit
0466dfb5
authored
Dec 24, 2016
by
Mark Stenglein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish fixing the models:
- had a couple mistakes still on naming etc.
parent
9ea9e5d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
47 deletions
+6
-47
models/Section.js
models/Section.js
+2
-43
models/Semester.js
models/Semester.js
+3
-3
models/University.js
models/University.js
+1
-1
No files found.
models/Section.js
View file @
0466dfb5
...
...
@@ -10,7 +10,7 @@ module.exports = function (sequelize, DataTypes) {
semester
:
{
type
:
DataTypes
.
STRING
,
references
:
{
model
:
'
Semester
'
,
model
:
'
Semester
s
'
,
key
:
'
slug
'
}
},
...
...
@@ -86,47 +86,6 @@ module.exports = function (sequelize, DataTypes) {
FclassType
:
DataTypes
.
STRING
,
Flocation
:
DataTypes
.
STRING
},
{
validate
:
{
Msession_validate
:
function
(
value
)
{
if
((
this
.
Msession
===
true
)
&&
(
this
.
MtimeStart
===
null
||
this
.
MtimeEnd
===
null
))
{
throw
new
Error
(
'
Start and end times must be defined for
'
+
'
Monday if class is set to true.
'
)
}
},
Tsession_validate
:
function
(
value
)
{
if
((
this
.
Tsession
===
true
)
&&
(
this
.
TtimeStart
===
null
||
this
.
TtimeEnd
===
null
))
{
throw
new
Error
(
'
Start and end times must be defined for
'
+
'
Tuesday if class is set to true.
'
)
}
},
Wsession_validate
:
function
(
value
)
{
if
((
this
.
Wsession
===
true
)
&&
(
this
.
WtimeStart
===
null
||
this
.
WtimeEnd
===
null
))
{
throw
new
Error
(
'
Start and end times must be defined for
'
+
'
Wednesday if class is set to true.
'
)
}
},
Rsession_validate
:
function
(
value
)
{
if
((
this
.
Rsession
===
true
)
&&
(
this
.
RtimeStart
===
null
||
this
.
RtimeEnd
===
null
))
{
throw
new
Error
(
'
Start and end times must be defined for
'
+
'
Thursday if class is set to true.
'
)
}
},
Fsession_validate
:
function
(
value
)
{
if
((
this
.
Fsession
===
true
)
&&
(
this
.
FtimeStart
===
null
||
this
.
FtimeEnd
===
null
))
{
throw
new
Error
(
'
Start and end times must be defined for
'
+
'
Friday if class is set to true.
'
)
}
}
},
indexes
:
[
{
unique
:
true
,
...
...
@@ -155,7 +114,7 @@ module.exports = function (sequelize, DataTypes) {
],
classMethods
:
{
associate
:
function
(
models
)
{
models
.
Section
.
belongsTo
(
models
.
Semester
)
models
.
Section
.
belongsTo
(
models
.
Semester
,
{
foreignKey
:
'
semester
'
}
)
}
}
})
...
...
models/Semester.js
View file @
0466dfb5
...
...
@@ -9,7 +9,7 @@ module.exports = function (sequelize, DataTypes) {
university
:
{
type
:
DataTypes
.
STRING
,
references
:
{
model
:
'
Universit
y
'
,
model
:
'
Universit
ies
'
,
key
:
'
slug
'
}
},
...
...
@@ -24,8 +24,8 @@ module.exports = function (sequelize, DataTypes) {
}
],
classMethods
:
{
associate
:
function
(
models
)
{
models
.
Semester
.
belongsTo
(
models
.
University
)
models
.
Semester
.
hasMany
(
models
.
Section
)
models
.
Semester
.
belongsTo
(
models
.
University
,
{
foreignKey
:
'
university
'
}
)
models
.
Semester
.
hasMany
(
models
.
Section
,
{
foreignKey
:
'
semester
'
}
)
}
}
})
...
...
models/University.js
View file @
0466dfb5
...
...
@@ -25,7 +25,7 @@ module.exports = function (sequelize, DataTypes) {
],
classMethods
:
{
associate
:
function
(
models
)
{
models
.
University
.
hasMany
(
models
.
Semester
)
models
.
University
.
hasMany
(
models
.
Semester
,
{
foreignKey
:
'
university
'
}
)
}
}
})
...
...
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