-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rename discount collection to offer
- Loading branch information
Showing
9 changed files
with
46 additions
and
47 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
webapp/src/components/DiscountKindBadge.tsx → webapp/src/components/OfferKindBadge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
webapp/src/payload/collections/Discount.ts → webapp/src/payload/collections/Offer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
webapp/src/server/api/routers/discount.ts → webapp/src/server/api/routers/offer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { Category, Discount, Media, Partner } from "~/payload/payload-types"; | ||
import { Category, Offer, Media, Partner } from "~/payload/payload-types"; | ||
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc"; | ||
import { ZGetListParams } from "~/server/types"; | ||
|
||
interface DiscountIncluded extends Discount { | ||
interface OfferIncluded extends Offer { | ||
partner: Partner & { icon: Media }; | ||
category: Category & { icon: Media }; | ||
} | ||
|
||
export const discountRouter = createTRPCRouter({ | ||
export const offerRouter = createTRPCRouter({ | ||
getList: publicProcedure | ||
.input(ZGetListParams) | ||
.query(async ({ ctx, input }) => { | ||
const { perPage, page, sort } = input; | ||
|
||
const discounts = await ctx.payload.find({ | ||
collection: "discounts", | ||
const offers = await ctx.payload.find({ | ||
collection: "offers", | ||
limit: perPage, | ||
page: page, | ||
sort, | ||
}); | ||
|
||
return { | ||
data: discounts.docs as DiscountIncluded[], | ||
metadata: { page, count: discounts.docs.length }, | ||
data: offers.docs as OfferIncluded[], | ||
metadata: { page, count: offers.docs.length }, | ||
}; | ||
}), | ||
}); |