feat(awards): add backgroundImage field and migration for medal cards
This commit is contained in:
parent
2a1c94072f
commit
d8867a643a
5 changed files with 20668 additions and 1 deletions
|
|
@ -74,6 +74,16 @@ export const Awards: CollectionConfig = {
|
||||||
condition: (data) => data?.type === "ribbon",
|
condition: (data) => data?.type === "ribbon",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "backgroundImage",
|
||||||
|
type: "upload",
|
||||||
|
relationTo: "media",
|
||||||
|
admin: {
|
||||||
|
description:
|
||||||
|
"A background image for the award card. Displayed as a faded backdrop behind the card content.",
|
||||||
|
condition: (data) => data?.type === "medal",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "medalDesign",
|
name: "medalDesign",
|
||||||
type: "json",
|
type: "json",
|
||||||
|
|
|
||||||
20630
src/migrations/20260902_195336_add_medal_backgrounds.json
Normal file
20630
src/migrations/20260902_195336_add_medal_backgrounds.json
Normal file
File diff suppressed because it is too large
Load diff
16
src/migrations/20260902_195336_add_medal_backgrounds.ts
Normal file
16
src/migrations/20260902_195336_add_medal_backgrounds.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "awards" ADD COLUMN "background_image_id" integer;
|
||||||
|
ALTER TABLE "awards" ADD CONSTRAINT "awards_background_image_id_media_id_fk" FOREIGN KEY ("background_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
CREATE INDEX "awards_background_image_idx" ON "awards" USING btree ("background_image_id");`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "awards" DROP CONSTRAINT "awards_background_image_id_media_id_fk";
|
||||||
|
|
||||||
|
DROP INDEX "awards_background_image_idx";
|
||||||
|
ALTER TABLE "awards" DROP COLUMN "background_image_id";`)
|
||||||
|
}
|
||||||
|
|
@ -14,6 +14,7 @@ import * as migration_20260831_180233_assignment_transfers from './20260831_1802
|
||||||
import * as migration_20260901_014006_add_assignment_transfer_event_target from './20260901_014006_add_assignment_transfer_event_target';
|
import * as migration_20260901_014006_add_assignment_transfer_event_target from './20260901_014006_add_assignment_transfer_event_target';
|
||||||
import * as migration_20260901_213108_add_ticket_votes_and_edit_history from './20260901_213108_add_ticket_votes_and_edit_history';
|
import * as migration_20260901_213108_add_ticket_votes_and_edit_history from './20260901_213108_add_ticket_votes_and_edit_history';
|
||||||
import * as migration_20260901_222200_add_admin_page_permissions from './20260901_222200_add_admin_page_permissions';
|
import * as migration_20260901_222200_add_admin_page_permissions from './20260901_222200_add_admin_page_permissions';
|
||||||
|
import * as migration_20260902_195336_add_medal_backgrounds from './20260902_195336_add_medal_backgrounds';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -94,6 +95,11 @@ export const migrations = [
|
||||||
{
|
{
|
||||||
up: migration_20260901_222200_add_admin_page_permissions.up,
|
up: migration_20260901_222200_add_admin_page_permissions.up,
|
||||||
down: migration_20260901_222200_add_admin_page_permissions.down,
|
down: migration_20260901_222200_add_admin_page_permissions.down,
|
||||||
name: '20260901_222200_add_admin_page_permissions'
|
name: '20260901_222200_add_admin_page_permissions',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260902_195336_add_medal_backgrounds.up,
|
||||||
|
down: migration_20260902_195336_add_medal_backgrounds.down,
|
||||||
|
name: '20260902_195336_add_medal_backgrounds'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1824,6 +1824,10 @@ export interface Award {
|
||||||
| number
|
| number
|
||||||
| boolean
|
| boolean
|
||||||
| null;
|
| null;
|
||||||
|
/**
|
||||||
|
* A background image for the award card. Displayed as a faded backdrop behind the card content.
|
||||||
|
*/
|
||||||
|
backgroundImage?: (number | null) | Media;
|
||||||
medalDesign?:
|
medalDesign?:
|
||||||
| {
|
| {
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
|
|
@ -3805,6 +3809,7 @@ export interface AwardsSelect<T extends boolean = true> {
|
||||||
image?: T;
|
image?: T;
|
||||||
experiencePoints?: T;
|
experiencePoints?: T;
|
||||||
ribbonDesign?: T;
|
ribbonDesign?: T;
|
||||||
|
backgroundImage?: T;
|
||||||
medalDesign?: T;
|
medalDesign?: T;
|
||||||
grantConfig?:
|
grantConfig?:
|
||||||
| T
|
| T
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue