From d6ca55c994a161b80e69a032a84852db04a7e3fe Mon Sep 17 00:00:00 2001 From: Menci Date: Fri, 19 Apr 2019 10:31:10 +0800 Subject: [PATCH] Use default value for some columns --- models/user.ts | 4 ++-- modules/api.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/models/user.ts b/models/user.ts index b320c10..48a4c58 100644 --- a/models/user.ts +++ b/models/user.ts @@ -46,10 +46,10 @@ export default class User extends Model { @TypeORM.Column({ nullable: true, type: "boolean" }) is_show: boolean; - @TypeORM.Column({ nullable: true, type: "boolean" }) + @TypeORM.Column({ nullable: true, type: "boolean", default: true }) public_email: boolean; - @TypeORM.Column({ nullable: true, type: "boolean" }) + @TypeORM.Column({ nullable: true, type: "boolean", default: true }) prefer_formatted_code: boolean; @TypeORM.Column({ nullable: true, type: "integer" }) diff --git a/modules/api.js b/modules/api.js index 2d3c5df..13ebee6 100644 --- a/modules/api.js +++ b/modules/api.js @@ -111,11 +111,9 @@ app.post('/api/sign_up', async (req, res) => { username: req.body.username, password: req.body.password, email: req.body.email, - public_email: true, is_show: syzoj.config.default.user.show, rating: syzoj.config.default.user.rating, - register_time: parseInt((new Date()).getTime() / 1000), - prefer_formatted_code: true + register_time: parseInt((new Date()).getTime() / 1000) }); await user.save(); @@ -200,11 +198,9 @@ app.get('/api/sign_up_confirm', async (req, res) => { username: obj.username, password: obj.password, email: obj.email, - public_email: true, is_show: syzoj.config.default.user.show, rating: syzoj.config.default.user.rating, - register_time: parseInt((new Date()).getTime() / 1000), - prefer_formatted_code: true + register_time: parseInt((new Date()).getTime() / 1000) }); await user.save();