-
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.
Added authentication support for tests Added more thorough validators Fixed missing field types in models Finalized code styling and indentations ..... and many more bug fixes.
- Loading branch information
Showing
24 changed files
with
1,342 additions
and
1,189 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
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 |
---|---|---|
@@ -1,86 +1,81 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
const Model = use('Model'); | ||
|
||
class Project extends Model | ||
{ | ||
|
||
static boot() | ||
{ | ||
super.boot(); | ||
|
||
// mongoDB hook for delete associates sprints. | ||
this.addHook('beforeDelete', 'ProjectForceDelete.removeSprints'); | ||
|
||
// mongoDB hook for delete associated releases. | ||
this.addHook('beforeDelete', 'ProjectForceDelete.removeReleases'); | ||
} | ||
|
||
static get primaryKey() | ||
{ | ||
return "_id"; | ||
} | ||
|
||
static get objectIDs() | ||
{ | ||
return ['_id', '_client_id', 'team_id']; | ||
} | ||
|
||
/** | ||
* Return the manager that belong to the project | ||
* | ||
* @returns {HasOne} | ||
*/ | ||
manager() | ||
{ | ||
return this.hasOne("App/Models/User", "_manager_id", "_id"); | ||
} | ||
|
||
/** | ||
* Get the client for the project | ||
* | ||
* @return {BelongsTo} | ||
*/ | ||
client() | ||
{ | ||
return this.belongsTo("App/Models/User", "_client_id", "_id"); | ||
} | ||
|
||
/** | ||
* Get the Phases of a project | ||
* | ||
* @return {HasMany} | ||
*/ | ||
sprints() | ||
{ | ||
return this.hasMany('App/Models/Sprint', '_id', '_project_id') | ||
} | ||
|
||
/** | ||
* Get the project version | ||
* | ||
* @return {HasMany} | ||
*/ | ||
releases() | ||
{ | ||
return this.hasMany('App/Models/Release', '_id', '_project_id'); | ||
} | ||
|
||
team() | ||
{ | ||
return this.hasOne('App/Models/Team', '_team_id', '_id'); | ||
} | ||
|
||
/** | ||
* Get the requirements of the project | ||
* | ||
* @return {HasMany} | ||
*/ | ||
requirements() | ||
{ | ||
return this.hasMany('App/Models/Requirement', '_id', '_project_id'); | ||
} | ||
|
||
|
||
static get primaryKey() | ||
{ | ||
return "_id"; | ||
} | ||
|
||
static get objectIDs() | ||
{ | ||
return ['_id', '_client_id', '_manager_id', '_team_id']; | ||
} | ||
|
||
static boot() | ||
{ | ||
super.boot(); | ||
|
||
// mongoDB hook for delete associates sprints. | ||
this.addHook('beforeDelete', 'ProjectForceDelete.removeSprints'); | ||
|
||
// mongoDB hook for delete associated releases. | ||
this.addHook('beforeDelete', 'ProjectForceDelete.removeReleases'); | ||
} | ||
|
||
/** | ||
* Return the manager that belong to the project | ||
* | ||
* @returns {HasOne} | ||
*/ | ||
manager() | ||
{ | ||
return this.hasOne("App/Models/User", "_manager_id", "_id"); | ||
} | ||
|
||
/** | ||
* Get the client for the project | ||
* | ||
* @return {BelongsTo} | ||
*/ | ||
client() | ||
{ | ||
return this.belongsTo("App/Models/User", "_client_id", "_id"); | ||
} | ||
|
||
/** | ||
* Get the Phases of a project | ||
* | ||
* @return {HasMany} | ||
*/ | ||
sprints() | ||
{ | ||
return this.hasMany('App/Models/Sprint', '_id', '_project_id') | ||
} | ||
|
||
/** | ||
* Get the project version | ||
* | ||
* @return {HasMany} | ||
*/ | ||
releases() | ||
{ | ||
return this.hasMany('App/Models/Release', '_id', '_project_id'); | ||
} | ||
|
||
/** | ||
* Get the team that the project has been assigned to | ||
* | ||
* @return {HasOne} | ||
*/ | ||
team() | ||
{ | ||
return this.hasOne('App/Models/Team', '_team_id', '_id'); | ||
} | ||
|
||
} | ||
|
||
module.exports = Project; |
Oops, something went wrong.