This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
@@ -24,7 +25,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = createSchema.safeParse(body);
|
const parsed = createSchema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const banner = await prisma.banner.create({ data: parsed.data });
|
const banner = await prisma.banner.create({ data: parsed.data as Prisma.BannerCreateInput });
|
||||||
return NextResponse.json({ banner }, { status: 201 });
|
return NextResponse.json({ banner }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
@@ -54,7 +55,13 @@ export async function POST(req: Request) {
|
|||||||
});
|
});
|
||||||
sortOrder = (max._max.sortOrder ?? 0) + 1;
|
sortOrder = (max._max.sortOrder ?? 0) + 1;
|
||||||
}
|
}
|
||||||
const created = await prisma.board.create({ data: { ...data, sortOrder } });
|
const { categoryId, sortOrder: _ignored, ...rest } = data;
|
||||||
|
const createData: Prisma.BoardCreateInput = {
|
||||||
|
...(rest as any),
|
||||||
|
sortOrder,
|
||||||
|
...(categoryId ? { category: { connect: { id: categoryId } } } : {}),
|
||||||
|
};
|
||||||
|
const created = await prisma.board.create({ data: createData });
|
||||||
return NextResponse.json({ board: created }, { status: 201 });
|
return NextResponse.json({ board: created }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const categories = await prisma.boardCategory.findMany({
|
const categories = await prisma.boardCategory.findMany({
|
||||||
@@ -20,7 +21,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = createSchema.safeParse(body);
|
const parsed = createSchema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const category = await prisma.boardCategory.create({ data: parsed.data });
|
const category = await prisma.boardCategory.create({ data: parsed.data as Prisma.BoardCategoryCreateInput });
|
||||||
return NextResponse.json({ category }, { status: 201 });
|
return NextResponse.json({ category }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const items = await prisma.partnerShop.findMany({ orderBy: [{ active: "desc" }, { sortOrder: "asc" }, { createdAt: "desc" }] });
|
const items = await prisma.partnerShop.findMany({ orderBy: [{ active: "desc" }, { sortOrder: "asc" }, { createdAt: "desc" }] });
|
||||||
@@ -20,7 +21,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = createSchema.safeParse(body);
|
const parsed = createSchema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const item = await prisma.partnerShop.create({ data: parsed.data });
|
const item = await prisma.partnerShop.create({ data: parsed.data as Prisma.PartnerShopCreateInput });
|
||||||
return NextResponse.json({ item }, { status: 201 });
|
return NextResponse.json({ item }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const items = await prisma.boardViewType.findMany({ orderBy: [{ scope: 'asc' }, { name: 'asc' }] });
|
const items = await prisma.boardViewType.findMany({ orderBy: [{ scope: 'asc' }, { name: 'asc' }] });
|
||||||
@@ -19,7 +20,7 @@ export async function POST(req: Request) {
|
|||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const exists = await prisma.boardViewType.findFirst({ where: { key: parsed.data.key } });
|
const exists = await prisma.boardViewType.findFirst({ where: { key: parsed.data.key } });
|
||||||
if (exists) return NextResponse.json({ error: 'duplicate_key' }, { status: 409 });
|
if (exists) return NextResponse.json({ error: 'duplicate_key' }, { status: 409 });
|
||||||
const created = await prisma.boardViewType.create({ data: parsed.data });
|
const created = await prisma.boardViewType.create({ data: parsed.data as Prisma.BoardViewTypeCreateInput });
|
||||||
return NextResponse.json({ item: created }, { status: 201 });
|
return NextResponse.json({ item: created }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -30,7 +31,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = createSchema.safeParse(body);
|
const parsed = createSchema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const data = await prisma.coupon.create({ data: parsed.data });
|
const data = await prisma.coupon.create({ data: parsed.data as Prisma.CouponCreateInput });
|
||||||
return NextResponse.json({ coupon: data }, { status: 201 });
|
return NextResponse.json({ coupon: data }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
const schema = z.object({ name: z.string().min(1), contact: z.string().min(1), category: z.string().optional(), message: z.string().min(1) });
|
const schema = z.object({ name: z.string().min(1), contact: z.string().min(1), category: z.string().optional(), message: z.string().min(1) });
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = schema.safeParse(body);
|
const parsed = schema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const created = await prisma.partnerInquiry.create({ data: parsed.data });
|
const created = await prisma.partnerInquiry.create({ data: parsed.data as Prisma.PartnerInquiryCreateInput });
|
||||||
return NextResponse.json({ inquiry: created }, { status: 201 });
|
return NextResponse.json({ inquiry: created }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import type { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
const schema = z.object({ name: z.string().min(1), category: z.string().min(1), latitude: z.coerce.number(), longitude: z.coerce.number(), address: z.string().optional(), contact: z.string().optional() });
|
const schema = z.object({ name: z.string().min(1), category: z.string().min(1), latitude: z.coerce.number(), longitude: z.coerce.number(), address: z.string().optional(), contact: z.string().optional() });
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
const parsed = schema.safeParse(body);
|
const parsed = schema.safeParse(body);
|
||||||
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
|
||||||
const created = await prisma.partnerRequest.create({ data: parsed.data });
|
const created = await prisma.partnerRequest.create({ data: parsed.data as Prisma.PartnerRequestCreateInput });
|
||||||
return NextResponse.json({ request: created }, { status: 201 });
|
return NextResponse.json({ request: created }, { status: 201 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export function RankIcon1st({ width = 20, height = 21 }: { width?: number; heigh
|
|||||||
<g clipPath="url(#paint1_angular_9465_19783_clip_path)" data-figma-skip-parse="true">
|
<g clipPath="url(#paint1_angular_9465_19783_clip_path)" data-figma-skip-parse="true">
|
||||||
<g transform="matrix(0 0.003 -0.003 0 10 9.7998)">
|
<g transform="matrix(0 0.003 -0.003 0 10 9.7998)">
|
||||||
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
<div style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export function RankIcon2nd({ width = 20, height = 21 }: { width?: number; heigh
|
|||||||
<g clipPath="url(#paint1_angular_9465_19777_clip_path)" data-figma-skip-parse="true">
|
<g clipPath="url(#paint1_angular_9465_19777_clip_path)" data-figma-skip-parse="true">
|
||||||
<g transform="matrix(0 0.003 -0.003 0 10 10.2002)">
|
<g transform="matrix(0 0.003 -0.003 0 10 10.2002)">
|
||||||
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
<div style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function RankIcon3rd({ width = 20, height = 20 }: { width?: number; heigh
|
|||||||
<g clipPath="url(#paint1_angular_9465_19771_clip_path)" data-figma-skip-parse="true">
|
<g clipPath="url(#paint1_angular_9465_19771_clip_path)" data-figma-skip-parse="true">
|
||||||
<g transform="matrix(0 0.003 -0.003 0 10 9.5)">
|
<g transform="matrix(0 0.003 -0.003 0 10 9.5)">
|
||||||
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
<foreignObject x="-1333.33" y="-1333.33" width="2666.67" height="2666.67">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml" style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
<div style={{background:"conic-gradient(from 90deg,rgba(255, 255, 255, 1) 0deg,rgba(224, 224, 224, 1) 360deg)",height:"100%",width:"100%",opacity:1}}></div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
|
import { Suspense } from "react";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import QueryProvider from "@/app/QueryProvider";
|
import QueryProvider from "@/app/QueryProvider";
|
||||||
import { AppHeader } from "@/app/components/AppHeader";
|
import { AppHeader } from "@/app/components/AppHeader";
|
||||||
@@ -26,7 +27,9 @@ export default function RootLayout({
|
|||||||
<div className="min-h-screen flex flex-col">
|
<div className="min-h-screen flex flex-col">
|
||||||
<div className="sticky top-0 z-50 bg-white/80 backdrop-blur">
|
<div className="sticky top-0 z-50 bg-white/80 backdrop-blur">
|
||||||
<div className="mx-auto w-full">
|
<div className="mx-auto w-full">
|
||||||
<AppHeader />
|
<Suspense fallback={null}>
|
||||||
|
<AppHeader />
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<main className="flex-1 bg-[#F2F2F2]">
|
<main className="flex-1 bg-[#F2F2F2]">
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
|
||||||
"use client";
|
"use client";
|
||||||
|
import Link from "next/link";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Button } from "@/app/components/ui/Button";
|
import { Button } from "@/app/components/ui/Button";
|
||||||
import { useToast } from "@/app/components/ui/ToastProvider";
|
import { useToast } from "@/app/components/ui/ToastProvider";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
|
||||||
"use client";
|
"use client";
|
||||||
|
import Link from "next/link";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
const fetcher = (url: string) => fetch(url).then((r) => r.json());
|
const fetcher = (url: string) => fetch(url).then((r) => r.json());
|
||||||
|
|||||||
Reference in New Issue
Block a user