Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pc committed Sep 14, 2019
1 parent 1880fe1 commit 3defa46
Show file tree
Hide file tree
Showing 14 changed files with 2,306 additions and 155 deletions.
11 changes: 11 additions & 0 deletions api/adminHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const loginHandler = async (event, context, callback) => {

}

const listExams = async (event, context, callback) => {

}

const listEntries = async (event, context, callback) => {

}
17 changes: 17 additions & 0 deletions api/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
adminPortal:
handler: api/handler.apiAdminHandler
description: Endpoints to handle all test portal requests
events:
- http:
path: admin
method: POST
cors: true

studentPortal:
handler: api/handler.apiCandidateHandler
description: Endpoints to handle all test portal requests
events:
- http:
path: test
method: POST
cors: true
11 changes: 11 additions & 0 deletions api/candidateHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const registerHandler = async (event, context, callback) => {

}

const listQuestions = async (event, context, callback) => {

}

const getQuestion = async (event, context, callback) => {

}
49 changes: 49 additions & 0 deletions api/handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

const loginHandler = async (event, context, callback) => {
//
}

const registerHandler = async (event, context, callback) => {
//
}

module.exports.apiAdminHandler = async (event, context, callback) => {
let body = event.body
if(typeof body == 'string'){
body = JSON.parse(body)
}
switch (body) {
case 'login':
loginHandler(event, context, callback)
break;
case 'listExams':
listExams(event, context, callback)
case 'listEntries':
listEntries(event, context, callback)
break;

default:
break;
}
}

module.exports.apiCandidateHandler = async (event, context, callback) => {
let body = event.body
if(typeof body == 'string'){
body = JSON.parse(body)
}
switch (body) {
case 'register':
registerHandler(event, context, callback)
break;
case 'listQuestions':
listQuestions(event, context, callback)
break;
case 'getQuestion':
getQuestion(event, context, callback)
break;
default:
break;
}
}
3 changes: 3 additions & 0 deletions config/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
appStage: dev
appRegion: localhost
appDBPath: /media/pc/Store/Projects/data/dynamodb
49 changes: 49 additions & 0 deletions database/Candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:service}Candidate${self:custom.config.appStage}
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: examId
AttributeType: S
-
AttributeName: lastModifiedOn
AttributeType: N

KeySchema:
-
AttributeName: id
KeyType: HASH
-
AttributeName: lastModifiedOn
KeyType: RANGE

GlobalSecondaryIndexes:
- IndexName: idIndex
KeySchema:
- AttributeName: id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

- IndexName: examIdIndex
KeySchema:
- AttributeName: examId
KeyType: HASH
- AttributeName: lastModifiedOn
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
50 changes: 50 additions & 0 deletions database/Exam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:service}Exam${self:custom.config.appStage}
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: status
AttributeType: S
-
AttributeName: createdOn
AttributeType: N


KeySchema:
-
AttributeName: id
KeyType: HASH
-
AttributeName: createdOn
KeyType: RANGE

GlobalSecondaryIndexes:
- IndexName: idIndex
KeySchema:
- AttributeName: id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

- IndexName: statusIndex
KeySchema:
- AttributeName: status
KeyType: HASH
- AttributeName: createdOn
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
91 changes: 49 additions & 42 deletions models/questions.yml → database/Question.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: users
AttributeDefinitions:
- AttributeName: id
AttributeType: S

- AttributeName: test_id
AttributeType: S

KeySchema:
- AttributeName: id
KeyType: HASH

GlobalSecondaryIndexes:
-
IndexName: testIndex
KeySchema:
-
AttributeName: test_id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
-
IndexName: testIndex
KeySchema:
-
AttributeName: test_id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:service}Question${self:custom.config.appStage}
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
-
AttributeName: examId
AttributeType: S
-
AttributeName: createdOn
AttributeType: N

KeySchema:
-
AttributeName: id
KeyType: HASH
-
AttributeName: createdOn
KeyType: RANGE

GlobalSecondaryIndexes:
- IndexName: idIndex
KeySchema:
- AttributeName: id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

- IndexName: examIdIndex
KeySchema:
- AttributeName: examId
KeyType: HASH
- AttributeName: createdOn
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1

ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
24 changes: 24 additions & 0 deletions database/User.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
TableName: ${self:service}User${self:custom.config.appStage}
AttributeDefinitions:
-
AttributeName: email
AttributeType: S
-
AttributeName: password
AttributeType: S

KeySchema:
-
AttributeName: email
KeyType: HASH
-
AttributeName: password
KeyType: RANGE


ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
14 changes: 0 additions & 14 deletions handler.js

This file was deleted.

48 changes: 0 additions & 48 deletions models/users.yml

This file was deleted.

Loading

0 comments on commit 3defa46

Please sign in to comment.