Browse Source

Use default value for some columns

pull/6/head
Menci 6 years ago
parent
commit
d6ca55c994
  1. 4
      models/user.ts
  2. 8
      modules/api.js

4
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" })

8
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();

Loading…
Cancel
Save