Fix /users/@me/settings get and migrarion

This commit is contained in:
Madeline
2022-08-21 20:00:35 +10:00
parent 60c8f3e6b2
commit af2f9a402f
2 changed files with 9 additions and 3 deletions
+3 -3
View File
@@ -4,13 +4,13 @@ import { route } from "@fosscord/api";
const router = Router();
export interface UserSettingsSchema extends Partial<UserSettings> {}
export interface UserSettingsSchema extends Partial<UserSettings> { }
router.get("/", route({}), async (req: Request, res: Response) => {
const user = await User.findOneOrFail(
{ id: req.user_id },
{ relations: ["settings"] }
)
{ select: ["settings"] }
);
return res.json(user.settings);
});
@@ -8,9 +8,15 @@ export class mobileFixes21660689892073 implements MigrationInterface {
ALTER TABLE \`user_settings\`
ADD \`banner_color\` varchar(255) NULL
`);
await queryRunner.query(`
UPDATE \`channels\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL
`);
await queryRunner.query(`
ALTER TABLE \`channels\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL
`);
await queryRunner.query(`
UPDATE \`guilds\` SET \`nsfw\` = 0 WHERE \`nsfw\` = NULL
`);
await queryRunner.query(`
ALTER TABLE \`guilds\` CHANGE \`nsfw\` \`nsfw\` tinyint NOT NULL
`);