-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (32 loc) · 1.29 KB
/
index.js
File metadata and controls
38 lines (32 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const {Keystone} = require('@keystone-alpha/keystone');
const {PasswordAuthStrategy} = require('@keystone-alpha/auth-password');
const {GraphQLApp} = require('@keystone-alpha/app-graphql');
const {AdminUIApp} = require('@keystone-alpha/app-admin-ui');
const {MongooseAdapter: Adapter} = require('@keystone-alpha/adapter-mongoose');
const {UserSchema, StudentSchema, ClassroomSchema, SubjectSchema, TeacherSchema, ScoresheetSchema, ExamSchema, ScoreSchema} = require('./models/index');
const PROJECT_NAME = "STRAMS";
const keystone = new Keystone({
name: PROJECT_NAME,
adapter: new Adapter(),
});
//Creation of lists for models.
keystone.createList('User', UserSchema);
keystone.createList('Student', StudentSchema);
keystone.createList('Classroom', ClassroomSchema);
keystone.createList('Subject', SubjectSchema);
keystone.createList('Teacher', TeacherSchema);
keystone.createList('Scoresheet', ScoresheetSchema);
keystone.createList('Exam', ExamSchema);
keystone.createList('Score', ScoreSchema);
const authStrategy = keystone.createAuthStrategy({
type: PasswordAuthStrategy,
list: 'User',
});
module.exports = {
keystone,
apps: [
new GraphQLApp(),
// To create an initial user you can temporarily remove the authStrategy below
new AdminUIApp({enableDefaultRoute: true, authStrategy}),
],
};