chore(LOY-64): better organisation of reward types and data
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
import { RewardId } from "@/types/enums/rewards"
|
||||
import { RESTAURANT_REWARD_IDS, REWARD_IDS } from "@/constants/rewards"
|
||||
|
||||
import type {
|
||||
RestaurantRewardId,
|
||||
RewardId,
|
||||
} from "@/types/components/myPages/rewards"
|
||||
import type { Reward } from "@/server/routers/contentstack/reward/output"
|
||||
|
||||
export function isValidRewardId(id: string): id is RewardId {
|
||||
return Object.values<string>(RewardId).includes(id)
|
||||
return Object.values<string>(REWARD_IDS).includes(id)
|
||||
}
|
||||
|
||||
export const RESTAURANT_REWARD_IDS = [
|
||||
RewardId.TenPercentFood,
|
||||
RewardId.TwoForOneBreakfast,
|
||||
RewardId.FifteenPercentFood,
|
||||
RewardId.FreeKidsDrink,
|
||||
RewardId.FreeBreakfast,
|
||||
] as const
|
||||
|
||||
export type RestaurantRewardId = (typeof RESTAURANT_REWARD_IDS)[number]
|
||||
|
||||
export function isRestaurantReward(
|
||||
rewardId: string
|
||||
): rewardId is RestaurantRewardId {
|
||||
@@ -40,4 +35,4 @@ export function isOnSiteTierReward(reward: Reward): boolean {
|
||||
|
||||
export function isRestaurantOnSiteTierReward(reward: Reward): boolean {
|
||||
return isOnSiteTierReward(reward) && isRestaurantReward(reward.reward_id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user