Skip to content

Commit c026639

Browse files
author
Ido Shamun
committed
feat: insane mode support
1 parent 8221114 commit c026639

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

migrations/20180804120255_insane.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exports.up = knex =>
2+
knex.schema.table('settings', (table) => {
3+
table.boolean('insane_mode').defaultTo(0);
4+
});
5+
6+
exports.down = knex =>
7+
knex.schema.table('settings', (table) => {
8+
table.dropColumn('insane_mode');
9+
});

src/models/settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const getByUserId = userId =>
1111
.map(row => Object.assign({}, row, {
1212
enableCardAnimations: row.enableCardAnimations === 1,
1313
showTopSites: row.showTopSites === 1,
14+
insaneMode: row.insaneMode === 1,
1415
}))
1516
.then(res => (res.length ? res[0] : null))
1617
.then((res) => {

src/routes/settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ router.post(
2828
theme: string(),
2929
showTopSites: boolean(),
3030
enableCardAnimations: boolean(),
31+
insaneMode: boolean(),
3132
}),
3233
}, {
3334
stripUnknown: true,

test/fixtures/settings.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ const output = [
1919
theme: 'darcula',
2020
showTopSites: false,
2121
enableCardAnimations: false,
22+
insaneMode: false,
2223
},
2324
{
2425
userId: 'user2',
2526
theme: 'darcula',
2627
showTopSites: true,
2728
enableCardAnimations: false,
29+
insaneMode: false,
2830
},
2931
];
3032

0 commit comments

Comments
 (0)