mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-29 14:09:52 +00:00
[rel/1518] Member flags
This commit is contained in:
@@ -69,7 +69,8 @@ export type PublicMemberKeys =
|
||||
| "bio"
|
||||
| "theme_colors"
|
||||
| "pronouns"
|
||||
| "communication_disabled_until";
|
||||
| "communication_disabled_until"
|
||||
| "flags";
|
||||
|
||||
export const PublicMemberProjection: PublicMemberKeys[] = [
|
||||
"id",
|
||||
@@ -87,6 +88,7 @@ export const PublicMemberProjection: PublicMemberKeys[] = [
|
||||
"theme_colors",
|
||||
"pronouns",
|
||||
"communication_disabled_until",
|
||||
"flags",
|
||||
];
|
||||
|
||||
export type PublicMember = Omit<Pick<Member, PublicMemberKeys>, "roles"> & {
|
||||
|
||||
@@ -51,6 +51,7 @@ export const MemberPrivateProjection: (keyof Member)[] = [
|
||||
"theme_colors",
|
||||
"pronouns",
|
||||
"communication_disabled_until",
|
||||
"flags",
|
||||
];
|
||||
|
||||
@Entity({
|
||||
@@ -156,6 +157,9 @@ export class Member extends BaseClassWithoutId {
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
collectibles?: Collectibles;
|
||||
|
||||
@Column({ type: "int", default: 0 })
|
||||
flags: number = 0;
|
||||
|
||||
@BeforeUpdate()
|
||||
@BeforeInsert()
|
||||
validate() {
|
||||
|
||||
13
src/util/migration/postgres/1772404321400-MemberFlags.ts
Normal file
13
src/util/migration/postgres/1772404321400-MemberFlags.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class MemberFlags1772404321400 implements MigrationInterface {
|
||||
name = "MemberFlags1772404321400";
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "members" ADD "flags" integer NOT NULL DEFAULT '0'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "members" DROP COLUMN "flags"`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user