Skip to content

Commit

Permalink
Merge pull request #1 from LPSci-Web-Development-Team/develop
Browse files Browse the repository at this point in the history
v1.00 (June 03, 2020)
  • Loading branch information
git-ced authored Jun 2, 2020
2 parents 921193f + a1ed966 commit c1f43a3
Show file tree
Hide file tree
Showing 33 changed files with 3,875 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/client/
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "loopback"
}
3 changes: 3 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"generator-loopback": {}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# My Application

The project is generated by [LoopBack](http://loopback.io).
3 changes: 3 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Client

This is the place for your application front-end files.
23 changes: 23 additions & 0 deletions common/models/candidate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

const CANDIDATE_POSITIONS = [
'President',
'Vice President',
'Secretary',
'Treasurer',
'Auditor',
'PIO',
'Peace Officer',
'Level Rep. (8)',
'Level Rep. (9)',
'Level Rep. (10)',
'Level Rep. (11)',
'Level Rep. (12)',
];

module.exports = function (Candidate) {
Candidate.validatesInclusionOf('position', {
in: CANDIDATE_POSITIONS,
message: 'Invalid position for Candidate',
});
};
55 changes: 55 additions & 0 deletions common/models/candidate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "candidate",
"plural": "candidates",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"mixins": {
"TimeStamp": {
"required": false,
"validateUpsert": true,
"silenceWarnings": false
}
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"firstName": {
"type": "string",
"required": true
},
"lastName": {
"type": "string",
"required": true
},
"position": {
"type": "string",
"required": true
},
"imgUrl": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {
"parties": {
"type": "belongsTo",
"model": "party",
"foreignKey": "partyId"
},
"voters": {
"type": "hasMany",
"model": "voter",
"foreignKey": "candidateId",
"through": "vote"
}
},
"acls": [],
"methods": {}
}
8 changes: 8 additions & 0 deletions common/models/election.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

module.exports = function (Election) {
Election.validatesInclusionOf('state', {
in: ['register', 'vote', 'disable'],
message: 'invalid state for Election',
});
};
24 changes: 24 additions & 0 deletions common/models/election.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "election",
"plural": "elections",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"state": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
5 changes: 5 additions & 0 deletions common/models/party.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(Party) {

};
35 changes: 35 additions & 0 deletions common/models/party.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "party",
"plural": "parties",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"mixins": {
"TimeStamp": {
"required": false,
"validateUpsert": true,
"silenceWarnings": false
}
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"name": {
"type": "string",
"required": true
},
"hexColor": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
17 changes: 17 additions & 0 deletions common/models/section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const SECTION_GRADE_LEVELS = [
7,
8,
9,
10,
11,
12,
];

module.exports = function (Section) {
Section.validatesInclusionOf('gradeLevel', {
in: SECTION_GRADE_LEVELS,
message: 'Invalid grade level',
});
};
35 changes: 35 additions & 0 deletions common/models/section.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "section",
"plural": "sections",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"mixins": {
"TimeStamp": {
"required": false,
"validateUpsert": true,
"silenceWarnings": false
}
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"gradeLevel": {
"type": "number",
"required": true
},
"name": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
5 changes: 5 additions & 0 deletions common/models/vote.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(Vote) {

};
41 changes: 41 additions & 0 deletions common/models/vote.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "vote",
"plural": "votes",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"mixins": {
"TimeStamp": {
"required": false,
"validateUpsert": true,
"silenceWarnings": false
}
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"position": {
"type": "string"
}
},
"validations": [],
"relations": {
"voter": {
"type": "belongsTo",
"model": "voter",
"foreignKey": "voterId"
},
"candidate": {
"type": "belongsTo",
"model": "candidate",
"foreignKey": "candidateId"
}
},
"acls": [],
"methods": {}
}
7 changes: 7 additions & 0 deletions common/models/voter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = function (Voter) {
Voter.validatesUniquenessOf(
'lrn', { message: 'It seems like you have already registered' },
);
};
89 changes: 89 additions & 0 deletions common/models/voter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"name": "voter",
"plural": "voters",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"forceId": false,
"restrictResetPasswordTokenScope": true,
"emailVerificationRequired": false,
"mixins": {
"TimeStamp": {
"required": false,
"validateUpsert": true,
"silenceWarnings": false
}
},
"properties": {
"id": {
"type": "string",
"id": true,
"defaultFn": "uuidv4"
},
"email": {
"type": "string",
"defaultFn": ""
},
"lrn": {
"type": "string",
"required": true
},
"firstName": {
"type": "string",
"required": true
},
"lastName": {
"type": "string",
"required": true
},
"isAdmin": {
"type": "boolean",
"required": true,
"defaultFn": "false"
}
},
"validations": [],
"relations": {
"sections": {
"type": "belongsTo",
"model": "section",
"foreignKey": "sectionId"
},
"candidates": {
"type": "hasMany",
"model": "candidate",
"foreignKey": "voterId",
"through": "vote"
},
"votes": {
"type": "hasMany",
"model": "vote",
"foreignKey": "voterId"
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$unauthenticated",
"permission": "ALLOW",
"property": "__get__votes"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$unauthenticated",
"permission": "ALLOW",
"property": "find"
}
],
"methods": {}
}
Loading

0 comments on commit c1f43a3

Please sign in to comment.