mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 00:03:05 +00:00
Add user profile costomisation fields to db
This commit is contained in:
1 parent
616972909b
commit
5a5c82f770
2 files changed
+42
-1
No files matched your search
@@ -27,7 +27,17 @@ import { Relationship } from "./Relationship";
|
||||
import { SecurityKey } from "./SecurityKey";
|
||||
import { Session } from "./Session";
|
||||
import { UserSettings } from "./UserSettings";
|
||||
import { ChannelType, PrivateUserProjection, PublicUser, PublicUserProjection, UserPrivate } from "@spacebar/schemas";
|
||||
import {
|
||||
AvatarDecorationData,
|
||||
ChannelType,
|
||||
Collectibles,
|
||||
DisplayNameStyle,
|
||||
PrimaryGuild,
|
||||
PrivateUserProjection,
|
||||
PublicUser,
|
||||
PublicUserProjection,
|
||||
UserPrivate,
|
||||
} from "@spacebar/schemas";
|
||||
|
||||
@Entity({
|
||||
name: "users",
|
||||
@@ -168,6 +178,18 @@ export class User extends BaseClass {
|
||||
@Column({ type: "simple-array", nullable: true })
|
||||
badge_ids?: string[];
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
avatar_decoration_data?: AvatarDecorationData;
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
display_name_styles?: DisplayNameStyle;
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
collectibles?: Collectibles;
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
primary_guild?: PrimaryGuild;
|
||||
|
||||
// TODO: I don't like this method?
|
||||
validate() {
|
||||
if (this.discriminator) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UserProfileCustomisation1770062009127 implements MigrationInterface {
|
||||
name = "UserProfileCustomisation1770062009127";
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "users" ADD "avatar_decoration_data" text`);
|
||||
await queryRunner.query(`ALTER TABLE "users" ADD "display_name_styles" text`);
|
||||
await queryRunner.query(`ALTER TABLE "users" ADD "collectibles" text`);
|
||||
await queryRunner.query(`ALTER TABLE "users" ADD "primary_guild" text`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "primary_guild"`);
|
||||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "collectibles"`);
|
||||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "display_name_styles"`);
|
||||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "avatar_decoration_data"`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user