Add showPopup, isGoodNews & Update API
This commit is contained in:
parent
3a574cf4e2
commit
75b352b721
|
@ -0,0 +1,21 @@
|
|||
export class AnnouncementPopup1688845537045 {
|
||||
name = "AnnouncementPopup1688845537045";
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" ADD "showPopup" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" ADD "isGoodNews" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" DROP COLUMN "isGoodNews"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "announcement" DROP COLUMN "showPopup"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -36,6 +36,16 @@ export class Announcement {
|
|||
})
|
||||
public imageUrl: string | null;
|
||||
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public showPopup: boolean;
|
||||
|
||||
@Column("boolean", {
|
||||
default: false,
|
||||
})
|
||||
public isGoodNews: boolean;
|
||||
|
||||
constructor(data: Partial<Announcement>) {
|
||||
if (data == null) return;
|
||||
|
||||
|
|
|
@ -47,6 +47,16 @@ export const meta = {
|
|||
optional: false,
|
||||
nullable: true,
|
||||
},
|
||||
showPopup: {
|
||||
type: "boolean",
|
||||
optional: true,
|
||||
nullable: false,
|
||||
},
|
||||
isGoodNews: {
|
||||
type: "boolean",
|
||||
optional: true,
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -57,6 +67,8 @@ export const paramDef = {
|
|||
title: { type: "string", minLength: 1 },
|
||||
text: { type: "string", minLength: 1 },
|
||||
imageUrl: { type: "string", nullable: true, minLength: 1 },
|
||||
showPopup: { type: "boolean" },
|
||||
isGoodNews: { type: "boolean" },
|
||||
},
|
||||
required: ["title", "text", "imageUrl"],
|
||||
} as const;
|
||||
|
@ -69,6 +81,8 @@ export default define(meta, paramDef, async (ps) => {
|
|||
title: ps.title,
|
||||
text: ps.text,
|
||||
imageUrl: ps.imageUrl,
|
||||
showPopup: ps.showPopup ?? false,
|
||||
isGoodNews: ps.isGoodNews ?? false,
|
||||
}).then((x) => Announcements.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
return Object.assign({}, announcement, {
|
||||
|
|
|
@ -57,6 +57,16 @@ export const meta = {
|
|||
optional: false,
|
||||
nullable: false,
|
||||
},
|
||||
showPopup: {
|
||||
type: "boolean",
|
||||
optional: true,
|
||||
nullable: false,
|
||||
},
|
||||
isGoodNews: {
|
||||
type: "boolean",
|
||||
optional: true,
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -100,5 +110,7 @@ export default define(meta, paramDef, async (ps) => {
|
|||
text: announcement.text,
|
||||
imageUrl: announcement.imageUrl,
|
||||
reads: reads.get(announcement)!,
|
||||
showPopup: announcement.showPopup,
|
||||
isGoodNews: announcement.isGoodNews,
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -24,6 +24,8 @@ export const paramDef = {
|
|||
title: { type: "string", minLength: 1 },
|
||||
text: { type: "string", minLength: 1 },
|
||||
imageUrl: { type: "string", nullable: true, minLength: 1 },
|
||||
showPopup: { type: "boolean" },
|
||||
isGoodNews: { type: "boolean" },
|
||||
},
|
||||
required: ["id", "title", "text", "imageUrl"],
|
||||
} as const;
|
||||
|
@ -38,5 +40,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
title: ps.title,
|
||||
text: ps.text,
|
||||
imageUrl: ps.imageUrl,
|
||||
showPopup: ps.showPopup ?? false,
|
||||
isGoodNews: ps.isGoodNews ?? false,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,6 +56,16 @@ export const meta = {
|
|||
optional: true,
|
||||
nullable: false,
|
||||
},
|
||||
showPopup: {
|
||||
type: "boolean",
|
||||
optional: false,
|
||||
nullable: false,
|
||||
},
|
||||
isGoodNews: {
|
||||
type: "boolean",
|
||||
optional: false,
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue