👔 feat: add banner priority ordering logic
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 1m48s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 1m48s
This commit is contained in:
@ -495,6 +495,7 @@ Table email_system_histories {
|
|||||||
|
|
||||||
Table hero_banner {
|
Table hero_banner {
|
||||||
id String [pk]
|
id String [pk]
|
||||||
|
orderPriority Int [unique]
|
||||||
isClickable Boolean [not null, default: false]
|
isClickable Boolean [not null, default: false]
|
||||||
title String
|
title String
|
||||||
description String
|
description String
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- A unique constraint covering the columns `[order]` on the table `hero_banner` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "hero_banner" ADD COLUMN "order" INTEGER;
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "hero_banner_order_key" ON "hero_banner"("order");
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `order` on the `hero_banner` table. All the data in the column will be lost.
|
||||||
|
- A unique constraint covering the columns `[orderPriority]` on the table `hero_banner` will be added. If there are existing duplicate values, this will fail.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- DropIndex
|
||||||
|
DROP INDEX "hero_banner_order_key";
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "hero_banner" DROP COLUMN "order",
|
||||||
|
ADD COLUMN "orderPriority" INTEGER;
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "hero_banner_orderPriority_key" ON "hero_banner"("orderPriority");
|
||||||
@ -556,6 +556,7 @@ model EmailSystemHistory {
|
|||||||
|
|
||||||
model HeroBanner {
|
model HeroBanner {
|
||||||
id String @id @db.Uuid
|
id String @id @db.Uuid
|
||||||
|
orderPriority Int? @unique
|
||||||
isClickable Boolean @default(false)
|
isClickable Boolean @default(false)
|
||||||
title String? @db.VarChar(225)
|
title String? @db.VarChar(225)
|
||||||
description String? @db.Text
|
description String? @db.Text
|
||||||
|
|||||||
@ -12,6 +12,14 @@ export const findAllActiveHeroBannerRepository = async () => {
|
|||||||
gte: new Date(),
|
gte: new Date(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
orderBy: [
|
||||||
|
{
|
||||||
|
orderPriority: "asc",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startDate: "asc",
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new AppError(500, "Failed to fetch active hero banners", error);
|
throw new AppError(500, "Failed to fetch active hero banners", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user