Skip to content

Commit d4c9e34

Browse files
committed
Merge branch 'master' of https://github.com/haystack/nb
2 parents 5905a0b + 6fba611 commit d4c9e34

24 files changed

+702
-225
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ node_modules
99
/uploads
1010
config.js
1111
email-config.js
12+
config/config.json
1213

1314
# local env files
1415
.env.local

app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const usersRouter = require('./routes/users');
1010
const classesRouter = require('./routes/classes');
1111
const filesRouter = require('./routes/files');
1212
const annotationsRouter = require('./routes/annotations');
13+
const spotlightsRouter = require('./routes/spotlights');
1314
const gradesRouter = require('./routes/grades');
1415

1516
require('./auth/auth');
@@ -54,6 +55,7 @@ app.use('/api/users', usersRouter);
5455
app.use('/api/classes', passport.authenticate('jwt', { session: false }), classesRouter);
5556
app.use('/api/files', passport.authenticate('jwt', { session: false }), filesRouter);
5657
app.use('/api/annotations', passport.authenticate('jwt', { session: false }), annotationsRouter);
58+
app.use('/api/spotlights', passport.authenticate('jwt', { session: false }), spotlightsRouter);
5759
app.use('/api/grades', passport.authenticate('jwt', { session: false }), gradesRouter);
5860

5961
// Handle errors.

config/config.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

migrations/20201214220840-user-email-unique.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = {
1212
},
1313

1414
down: async (queryInterface, Sequelize) => {
15-
15+
return Promise.all([
16+
queryInterface.removeConstraint('users', 'custom_unique_constraint_name')
17+
])
1618
}
1719
};

migrations/20201216031909-add_delete_column.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ module.exports = {
1515
},
1616

1717
down: async (queryInterface, Sequelize) => {
18-
/**
19-
* Add reverting commands here.
20-
*
21-
* Example:
22-
* await queryInterface.dropTable('users');
23-
*/
18+
return Promise.all([
19+
queryInterface.removeColumn('file_system_objects', 'deleted')
20+
])
2421
}
2522
};

migrations/20201218201543-add-reset-password-field.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@ module.exports = {
1616

1717
},
1818
down: async (queryInterface, Sequelize) => {
19+
return Promise.all([
20+
queryInterface.removeColumn('users', 'reset_password_id')
21+
])
1922
}
2023
};

migrations/20210104010943-class-section-unique.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ module.exports = {
99
});
1010
},
1111

12-
down: async (queryInterface, Sequelize) => {}
12+
down: async (queryInterface, Sequelize) => {
13+
return Promise.all([
14+
queryInterface.removeConstraint('sections', 'section_name_classid_key')
15+
])
16+
}
1317
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface, Sequelize) => {
5+
await queryInterface.createTable('spotlights', {
6+
id: {
7+
allowNull: false,
8+
defaultValue: Sequelize.UUIDV1,
9+
primaryKey: true,
10+
type: Sequelize.UUID
11+
},
12+
type: {
13+
type: Sequelize.ENUM,
14+
values: ['NONE', 'IN', 'ABOVE', 'BELLOW', 'LEFT', 'RIGHT', 'EM', 'MARGIN']
15+
},
16+
created_at: {
17+
allowNull: false,
18+
type: Sequelize.DATE
19+
},
20+
updated_at: {
21+
allowNull: false,
22+
type: Sequelize.DATE
23+
}
24+
});
25+
},
26+
down: async (queryInterface, Sequelize) => {
27+
await queryInterface.dropTable('spotlights');
28+
await queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_spotlights_type";');
29+
}
30+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface, Sequelize) => {
5+
await queryInterface.addColumn('spotlights', 'annotation_id', {
6+
type: Sequelize.UUID,
7+
references: {
8+
model: 'annotations',
9+
key: 'id',
10+
},
11+
onDelete: 'CASCADE',
12+
});
13+
},
14+
15+
down: async (queryInterface, Sequelize) => {
16+
await queryInterface.removeColumn('spotlights', 'annotation_id');
17+
}
18+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface, Sequelize) => {
5+
await queryInterface.addConstraint('spotlights', {
6+
fields: ['annotation_id'],
7+
type: 'unique',
8+
name: 'annotation_id_key'
9+
});
10+
11+
},
12+
13+
down: async (queryInterface, Sequelize) => {
14+
queryInterface.removeConstraint('spotlights', 'annotation_id_key')
15+
}
16+
};

0 commit comments

Comments
 (0)