chore(admin): Prisma.CarbetWhereInput type + cleanup options orphelines
This commit is contained in:
parent
00a5533bea
commit
fea55a7ddb
1 changed files with 5 additions and 18 deletions
|
|
@ -3,8 +3,9 @@
|
|||
*/
|
||||
|
||||
import "server-only";
|
||||
import { Prisma } from "@/generated/prisma/client";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { AccessType, CarbetStatus, TransportMode, UserRole } from "@/generated/prisma/enums";
|
||||
import { AccessType, CarbetStatus, UserRole } from "@/generated/prisma/enums";
|
||||
|
||||
export type AdminCarbetListItem = {
|
||||
id: string;
|
||||
|
|
@ -29,7 +30,7 @@ export type AdminCarbetFilters = {
|
|||
};
|
||||
|
||||
export async function listCarbetsAdmin(filters: AdminCarbetFilters = {}): Promise<AdminCarbetListItem[]> {
|
||||
const where: Parameters<typeof prisma.carbet.findMany>[0]["where"] = {};
|
||||
const where: Prisma.CarbetWhereInput = {};
|
||||
if (filters.q) {
|
||||
where.OR = [
|
||||
{ title: { contains: filters.q, mode: "insensitive" } },
|
||||
|
|
@ -112,19 +113,5 @@ export async function getCarbetForEdit(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
export const ACCESS_TYPE_OPTIONS: { value: AccessType; label: string }[] = [
|
||||
{ value: AccessType.ROAD_AND_RIVER, label: "🛣️ Route + fleuve" },
|
||||
{ value: AccessType.RIVER_ONLY, label: "🛶 Expédition fleuve" },
|
||||
];
|
||||
|
||||
export const TRANSPORT_MODE_OPTIONS: { value: TransportMode; label: string }[] = [
|
||||
{ value: TransportMode.SELF_ARRANGE, label: "🗺️ À organiser par le voyageur" },
|
||||
{ value: TransportMode.OWNER_PROVIDES, label: "👤 Le loueur fournit" },
|
||||
{ value: TransportMode.PARTNER_PROVIDER, label: "🤝 Partenaire référencé" },
|
||||
];
|
||||
|
||||
export const STATUS_OPTIONS: { value: CarbetStatus; label: string }[] = [
|
||||
{ value: CarbetStatus.DRAFT, label: "Brouillon" },
|
||||
{ value: CarbetStatus.PUBLISHED, label: "Publié" },
|
||||
{ value: CarbetStatus.ARCHIVED, label: "Archivé" },
|
||||
];
|
||||
// Options enum déplacées dans `./carbet-options.ts` pour être importables
|
||||
// depuis les composants client (ce fichier-ci est server-only).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue