Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/introduce queue feature #37

Merged
merged 23 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/booths/[boothId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { BoothItem } from "@/src/entities/booth";
import { getBoothDetail } from "@/src/entities/booth/api/boothDetail";
import { DeleteButton } from "@/src/features/booth/ui/DeleteButton";
import { EditButton } from "@/src/features/booth/ui/EditButton";
import { SwitchButton } from "@/src/features/booth/ui/SwitchButton";
import BoothDetail from "@/src/pages/booths/booth-detail";
import { API_URL } from "@/src/shared/api/config";
import { Booth, BoothCategoryKeys, Product } from "@/src/shared/lib/types";
import React from "react";

export default async function BoothDetailPage({
params,
}: {
params: { boothId: string };
}) {
const boothId = parseInt(params.boothId);
const { data: booth } = await getBoothDetail(boothId);

return <BoothDetail booth={booth} />;
}
53 changes: 53 additions & 0 deletions mocks/api/booth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { API_URL } from "@/src/shared/api/config";
import { Booth } from "@/src/shared/lib/types";
import { HttpResponse, http } from "msw";
import { booths } from "./constants/booths";

const allBooths = new Map(booths.map((booth) => [booth.id, booth]));

const boothHandler = [
http.get(`${API_URL}/api/booths`, () => {
Expand All @@ -26,6 +30,55 @@ const boothHandler = [
],
});
}),
http.get(`${API_URL}/api/booths/:boothId`, ({ params }) => {
const boothId = parseInt(params.boothId as string);

const booth = allBooths.get(boothId);

if (booth) {
return HttpResponse.json({
data: {
...booth,
},
});
}

return HttpResponse.json("Not found", { status: 404 });
}),
http.get(`${API_URL}/waiting/pin/:boothId`, ({ params }) => {
const boothId = parseInt(params.boothId as string);

const booth = allBooths.get(boothId);

if (booth) {
return HttpResponse.json({
code: "200",
message: "성공",
data: "1234",
});
}

return new HttpResponse("Not found", {
status: 404,
});
}),
http.post(`${API_URL}/waiting/pin/:boothId`, ({ params }) => {
const boothId = parseInt(params.boothId as string);

const booth = allBooths.get(boothId);

if (booth) {
return HttpResponse.json({
code: "200",
message: "성공",
data: "5678",
});
}

return new HttpResponse("Not found", {
status: 404,
});
}),
];

export default boothHandler;
164 changes: 164 additions & 0 deletions mocks/api/constants/booths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import { Booth } from "@/src/shared/lib/types";

export const booths: Booth[] = [
{
id: 0,
name: "주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점주점",
category: "BAR",
description:
"대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다 대한민국 모든 술을 파는 주점주점입니다",
thumbnail:
"https://www.google.com/url?sa=i&url=https%3A%2F%2Fnamu.wiki%2Fw%2F%25ED%258E%258D&psig=AOvVaw02Jb7NXU-0lV_1FDkWRjqU&ust=1715663118647000&source=images&cd=vfe&opi=89978449&ved=0CBEQjRxqFwoTCMCRk5PtiYYDFQAAAAAdAAAAABAJ",
warning: "건국대학생만 입장가능",
location: "법학관 앞",
latitude: 0.0,
longitude: 0.0,
menus: [],
enabled: true,
},
{
id: 1,
name: "부동산학관 부스",
category: "FOOD",
description: "부동산학관에 위치한 닭꼬치맛집",
thumbnail:
"https://content.foodspring.co.kr/vendor/1781/images/101_4100052181_r.png",
warning: "누구나 환영",
location: "부동산학관 1층",
latitude: 37.54318618774414,
longitude: 127.0783920288086,
menus: [
{
id: 0,
name: "닭꼬치",
price: 5000,
imgUrl:
"https://content.foodspring.co.kr/vendor/1781/images/101_4100052181_r.png",
},
{
id: 1,
name: "타코야끼",
price: 4500,
imgUrl:
"https://thenaum.cdn-nhncommerce.com/data/goods/18/01/03/1000001570/1000001570_add3_023.jpg",
},
{
id: 2,
name: "닭강정",
price: 6000,
imgUrl:
"https://gwchild114.firstmall.kr/data/goods/1/2021/06/42952_tmp_bfbe39f750e2db665da61b3a2e3c74697887large.png",
},
],
enabled: false,
},
{
id: 2,
name: "공대주점",
category: "BAR",
description:
"컴퓨터 공학과와 물리학과가 함께하는 합동부스입니다. 방문자 이벤트로 무료 안주 하나씩 제공중이에요!!",
thumbnail:
"https://img3.yna.co.kr/photo/yna/YH/2022/05/25/PYH2022052524930001300_P4.jpg",
warning: "누구나 환영",
location: "공학관 ",
latitude: 37.54104232788086,
longitude: 127.07910919189453,
menus: [
{
id: 0,
name: "닭강정",
price: 6000,
imgUrl:
"https://gwchild114.firstmall.kr/data/goods/1/2021/06/42952_tmp_bfbe39f750e2db665da61b3a2e3c74697887large.png",
},
{
id: 1,
name: "파전",
price: 12000,
imgUrl:
"https://recipe1.ezmember.co.kr/cache/recipe/2021/10/06/fc673b15bc044419eba3f16c02981bd01.jpg",
},
{
id: 2,
name: "콘치즈",
price: 5000,
imgUrl:
"https://roout.co.kr/m/p/u/CuAhLhz/labels/category%3A%EC%BD%98%EC%B9%98%EC%A6%88/i/HWBqoVuw1Qg.jpg",
},
{
id: 3,
name: "소주",
price: 5000,
imgUrl:
"https://img.khan.co.kr/news/2022/02/18/l_2022021801002225800200181.jpg",
},
{
id: 4,
name: "주",
price: 5000,
imgUrl:
"https://health.chosun.com/site/data/img_dir/2015/08/11/2015081101302_0.jpg",
},
],
enabled: true,
},
{
id: 3,
name: "생명대 화장실",
category: "TOILET",
description: "생명대 1층,2층,3층에 위치해있습니다",
thumbnail:
"https://image.fnnews.com/resource/media/image/2021/11/01/202111011759157636_l.jpg",
warning: "누구나 이용가능",
location: "생명대학교 내부",
latitude: 37.54094314575195,
longitude: 127.07466888427734,
menus: [],
enabled: true,
},
{
id: 4,
name: "법학관 의무실",
category: "MEDICAL",
description:
"밴드,붕대,응급처치를 받을수있는 의무실입니다. 간단한 치료가 가능합니다",
thumbnail:
"https://image.fnnews.com/resource/media/image/2021/11/01/202111011759157636_l.jpg",
warning: "누구나 이용가능",
location: "법학관 앞",
latitude: 37.541473388671875,
longitude: 127.07539367675781,
menus: [],
enabled: true,
},
{
id: 5,
name: "유니페스",
category: "EVENT",
description:
"유니페스 팀 부스입니다.\n 앱에 관한 설명을 듣고 축제 부스 운영을 기획중이시라면, 부스 등록 부탁드립니다.",
thumbnail: "https://avatars.githubusercontent.com/u/162893196?s=200&v=4",
warning: "",
location: "청심대 앞",
latitude: 37.542381286621094,
longitude: 127.0772476196289,
menus: [],
enabled: true,
},
{
id: 6,
name: "일감호 보트",
category: "EVENT",
description:
"일감호에 보트타러 오세요~\n2인까지 탑승가능하며, 구명조끼 필수입니다.",
thumbnail:
"https://i.namu.wiki/i/opFGNCxPd-Hb6Yrt0iA0AKnzzlwtnNHDqfg4-dQBZHOSYbZTiv9Ti_YhBK8H71NeL4_LKSxFYFvKZiDo10WPVA.webp",
warning: "건국대 학생 전용",
location: "청심대 앞",
latitude: 37.54237365722656,
longitude: 127.07644653320312,
menus: [],
enabled: true,
},
];
48 changes: 48 additions & 0 deletions mocks/api/constants/groups.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { QueueGroup } from "@/src/shared/lib/types";

export const groups: QueueGroup[] = [
{
boothId: 77,
waitingId: 123,
partySize: 1,
tel: "01012345678",
deviceId: "1sdasdg12421",
createdAt: "2024-08-12T16:07:36.057Z",
updatedAt: "2024-08-12T16:07:36.057Z",
status: "RESERVED",
waitingOrder: 1,
},
{
boothId: 77,
waitingId: 124,
partySize: 2,
tel: "01012345678",
deviceId: "1sdasdg12421",
createdAt: "2024-08-12T16:07:36.057Z",
updatedAt: "2024-08-12T16:07:36.057Z",
status: "CALLED",
waitingOrder: 2,
},
{
boothId: 77,
waitingId: 125,
partySize: 3,
tel: "01012345678",
deviceId: "1sdasdg12421",
createdAt: "2024-08-12T16:07:36.057Z",
updatedAt: "2024-08-12T16:07:36.057Z",
status: "COMPLETED",
waitingOrder: 3,
},
{
boothId: 77,
waitingId: 126,
partySize: 4,
tel: "01012345678",
deviceId: "1sdasdg12421",
createdAt: "2024-08-12T16:07:36.057Z",
updatedAt: "2024-08-12T16:07:36.057Z",
status: "CANCELED",
waitingOrder: 4,
},
];
Loading
Loading