Skip to content

Commit

Permalink
Merge pull request #81 from AII-the-time/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
raipen authored Oct 24, 2023
2 parents b536fbd + 6789295 commit 6a3491e
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
key: ${{ secrets.KEY }}
script: |
cd ~
docker-compose down
docker-compose down --rmi local
docker-compose pull
docker-compose up -d
31 changes: 19 additions & 12 deletions prisma/menuSeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ const mixedMaterialData = mixedMaterialRawData.split('\n').slice(2).join('\n').s
});

const menuRawData = fs.readFileSync(path.join(process.cwd(),'prisma', '소예다방-메뉴.csv'), 'utf8').toString().trim();
const menuData = menuRawData.split('\n').slice(3).join('\n').split('\n,,,,,,\n').map((menu) => {
const menuData = menuRawData.split('\n').slice(3).join('\n').split('\n,,,,,,,\n').map((menu) => {
const rows = menu.split('\n');
const name = rows[0].split(',')[0];
const price = rows[0].split(',')[1];
const category = rows[0].split(',')[2];
const materials = rows.map((row) => {
const [_,__,name, ...amounts] = row.split(',');
const [_,__,___,name, ...amounts] = row.split(',');
const [coldRegularAmount, coldSizeUpAmount, hotRegularAmount, hotSizeUpAmount] = amounts.map(Number);
return {
name,
Expand All @@ -43,9 +44,11 @@ const menuData = menuRawData.split('\n').slice(3).join('\n').split('\n,,,,,,\n')
hotSizeUpAmount
};
});
return { name, price, materials };
return { name, price, category, materials };
});

const categoryData = [...new Set(menuData.map((menu) => menu.category))];

export const printAllStocks = () => {
const stocks = [...new Set([...new Set(menuData.flatMap((menu) => menu.materials.map((material) => material.name)))].flatMap((name) => {
const materials = mixedMaterialData.find((material) => material.name === name)?.materials;
Expand Down Expand Up @@ -124,6 +127,7 @@ export default async (prisma: PrismaClient, storeId: number) => {
return {
name: menu.name,
price: menu.price,
category: menu.category,
materials: menu.materials.map((material) => {
const stock = materials.find((stock) => stock.name === material.name);
if(stock) {
Expand All @@ -149,20 +153,23 @@ export default async (prisma: PrismaClient, storeId: number) => {
})
};
});
const category = await prisma.category.create({
data: {
storeId,
name: '미분류',
sort: 3,
createdAt: new Date(),
updatedAt: new Date(),
},
await prisma.category.createMany({
data: categoryData.map((category,index) => ({
name: category,
sort: index+3,
storeId
}))
});
const categoies = await prisma.category.findMany({
where: {
storeId
}
});
await prisma.menu.createMany({
data: menuDataWithMaterials.map((menu,index) => ({
name: menu.name,
price: menu.price,
categoryId: category.id,
categoryId: categoies.find((category) => category.name === menu.category)!.id,
sort: index+1,
storeId,
}))
Expand Down
308 changes: 154 additions & 154 deletions prisma/소예다방-메뉴.csv
Original file line number Diff line number Diff line change
@@ -1,154 +1,154 @@
소예다방,,,,,,
메뉴,,재료,아이스,,핫,
,,,일반,사이즈업,일반,사이즈업
아메리카노,3500,물,150,300,300,
,,원두,25,50,25,
,,,,,,
시그니처 라떼,5000,소스,75,,60,
,,우유,190,,180,
,,원두,25,,25,
,,,,,,
다방 커피,5000,소스,25,,20,
,,우유,180,,200,
,,원두,25,,25,
,,설탕,25,,25,
,,,,,,
헤이즐넛 라떼,5000,소스,25,,20,
,,우유,180,,200,
,,원두,25,,25,
,,헤이즐넛 시럽,35,,35,
,,,,,,
바닐라 라떼,5000,소스,25,,20,
,,우유,180,,200,
,,원두,25,,25,
,,바닐라 시럽,35,,35,
,,,,,,
라떼,4500,원두,25,,25,
,,우유,220,,240,
,,,,,,
아몬드 라떼,5000,원두,25,,25,
,,아몬드 우유,220,,240,
,,,,,,
아몬드 모카 라떼,5500,원두,25,,25,
,,아몬드 우유,200,,200,
,,초코 시럽,50,,50,
,,,,,,
카페 모카,5000,소스,25,,20,
,,우유,180,,200,
,,원두,25,,25,
,,초코 시럽,50,,50,
,,,,,,
카라멜 마끼야또,5000,소스,25,,20,
,,우유,180,,200,
,,원두,25,,25,
,,카라멜 시럽,50,,50,
,,,,,,
카푸치노,4500,우유,,,240,
,,원두,,,25,
,,,,,,
디카페인 아메리카노,4500,물,200,,200,
,,원액,80,,60,
,,,,,,
초코라떼,5000,우유,180,,200,
,,소스,25,,20,
,,초코시럽,50,,50,
,,,,,,
딸기라떼,5800,우유,200,,,
,,소스,25,,,
,,딸기청,80,,,
,,,,,,
녹차라떼,5000,우유,220,,220,
,,소스,20,,20,
,,녹차가루,45,,35,
,,,,,,
곡물라떼,5000,우유,220,,200,
,,소스,25,,20,
,,곡물가루,50,,50,
,,꿀,20,,20,
,,,,,,
패션후르츠 라떼,5800,우유,220,,200,
,,소스,25,,20,
,,패션후르츠 청,80,,70,
,,,,,,
오디라떼,5000,우유,220,,200,
,,소스,20,,20,
,,오디 코디얼,60,,50,
,,,,,,
진저라떼,5000,우유,220,,200,
,,소스,20,,20,
,,생강 코디얼,60,,50,
,,,,,,
호박라떼,5000,우유,220,,200,
,,소스,20,,20,
,,호박 코디얼,50,,50,
,,,,,,
고구마라떼,5000,우유,220,,200,
,,소스,20,,20,
,,고구마 코디얼,50,,50,
,,,,,,
패션후르츠 주스,5500,물,190,,,
,,패션후르츠 청,80,,,
,,,,,,
패션후르츠 에이드,6000,탄산수,1,,,
,,패션후르츠 청,80,,,
,,,,,,
오렌지 주스,5000,물,190,,,
,,오렌지 청,30,,,
,,오렌지 과육,70,,,
,,,,,,
오렌지 에이드,5500,탄산수,1,,,
,,오렌지 청,30,,,
,,오렌지 과육,70,,,
,,,,,,
자몽 주스,5000,물,190,,,
,,자몽 청,30,,,
,,자몽 과육,70,,,
,,,,,,
자몽 에이드,5500,탄산수,1,,,
,,자몽 청,30,,,
,,자몽 과육,70,,,
,,,,,,
블루베리 주스,5000,물,190,,,
,,블루베리 청,40,,,
,,블루베리 과육,60,,,
,,,,,,
블루베리 에이드,5500,탄산수,1,,,
,,블루베리 청,40,,,
,,블루베리 과육,60,,,
,,,,,,
매실 주스,5000,물,190,,,
,,매실 청,100,,,
,,,,,,
매실 에이드,5500,탄산수,1,,,
,,매실 청,100,,,
,,,,,,
오미자 주스,5000,물,190,,,
,,오미자 청,80,,,
,,,,,,
오미자 에이드,5500,탄산수,1,,,
,,오미자 청,80,,,
,,,,,,
생강레몬차,4500,생강레몬 코디얼,50,,50,
,,대추 편,,,3,
,,,,,,
생강차,4500,생강 코디얼,50,,50,
,,대추 편,,,3,
,,,,,,
유자차,4500,유자 코디얼,60,,60,
,,대추 편,,,3,
,,,,,,
오디차,4500,오디 코디얼,50,,50,
,,대추 편,,,3,
,,,,,,
오미자차,4500,오미자 청,,,50,
,,대추 편,,,3,
,,,,,,
매실차,4500,매실 청,,,50,
,,대추 편,,,3,
,,,,,,
아이스티,4000,수제 청 과육,40,,,
,,아이스티,40,,,
,,,,,,
밀크티,4900,밀크티 베이스,100,210,100,
,,소스,10,20,10,
,,우유,200,400,180,
소예다방,,,,,,,
메뉴,,,재료,아이스,,핫,
,,,,일반,사이즈업,일반,사이즈업
아메리카노,3500,커피,물,150,300,300,
,,,원두,25,50,25,
,,,,,,,
시그니처 라떼,5000,커피,소스,75,,60,
,,,우유,190,,180,
,,,원두,25,,25,
,,,,,,,
다방 커피,5000,커피,소스,25,,20,
,,,우유,180,,200,
,,,원두,25,,25,
,,,설탕,25,,25,
,,,,,,,
헤이즐넛 라떼,5000,커피,소스,25,,20,
,,,우유,180,,200,
,,,원두,25,,25,
,,,헤이즐넛 시럽,35,,35,
,,,,,,,
바닐라 라떼,5000,커피,소스,25,,20,
,,,우유,180,,200,
,,,원두,25,,25,
,,,바닐라 시럽,35,,35,
,,,,,,,
라떼,4500,커피,원두,25,,25,
,,,우유,220,,240,
,,,,,,,
아몬드 라떼,5000,커피,원두,25,,25,
,,,아몬드 우유,220,,240,
,,,,,,,
아몬드 모카 라떼,5500,커피,원두,25,,25,
,,,아몬드 우유,200,,200,
,,,초코 시럽,50,,50,
,,,,,,,
카페 모카,5000,커피,소스,25,,20,
,,,우유,180,,200,
,,,원두,25,,25,
,,,초코 시럽,50,,50,
,,,,,,,
카라멜 마끼야또,5000,커피,소스,25,,20,
,,,우유,180,,200,
,,,원두,25,,25,
,,,카라멜 시럽,50,,50,
,,,,,,,
카푸치노,4500,커피,우유,,,240,
,,,원두,,,25,
,,,,,,,
디카페인 아메리카노,4500,커피,물,200,,200,
,,,원액,80,,60,
,,,,,,,
초코라떼,5000,라떼,우유,180,,200,
,,,소스,25,,20,
,,,초코시럽,50,,50,
,,,,,,,
딸기라떼,5800,라떼,우유,200,,,
,,,소스,25,,,
,,,딸기청,80,,,
,,,,,,,
녹차라떼,5000,라떼,우유,220,,220,
,,,소스,20,,20,
,,,녹차가루,45,,35,
,,,,,,,
곡물라떼,5000,라떼,우유,220,,200,
,,,소스,25,,20,
,,,곡물가루,50,,50,
,,,꿀,20,,20,
,,,,,,,
패션후르츠 라떼,5800,라떼,우유,220,,200,
,,,소스,25,,20,
,,,패션후르츠 청,80,,70,
,,,,,,,
오디라떼,5000,라떼,우유,220,,200,
,,,소스,20,,20,
,,,오디 코디얼,60,,50,
,,,,,,,
진저라떼,5000,라떼,우유,220,,200,
,,,소스,20,,20,
,,,생강 코디얼,60,,50,
,,,,,,,
호박라떼,5000,라떼,우유,220,,200,
,,,소스,20,,20,
,,,호박 코디얼,50,,50,
,,,,,,,
고구마라떼,5000,라떼,우유,220,,200,
,,,소스,20,,20,
,,,고구마 코디얼,50,,50,
,,,,,,,
패션후르츠 주스,5500,주스/에이드,물,190,,,
,,,패션후르츠 청,80,,,
,,,,,,,
패션후르츠 에이드,6000,주스/에이드,탄산수,1,,,
,,,패션후르츠 청,80,,,
,,,,,,,
오렌지 주스,5000,주스/에이드,물,190,,,
,,,오렌지 청,30,,,
,,,오렌지 과육,70,,,
,,,,,,,
오렌지 에이드,5500,주스/에이드,탄산수,1,,,
,,,오렌지 청,30,,,
,,,오렌지 과육,70,,,
,,,,,,,
자몽 주스,5000,주스/에이드,물,190,,,
,,,자몽 청,30,,,
,,,자몽 과육,70,,,
,,,,,,,
자몽 에이드,5500,주스/에이드,탄산수,1,,,
,,,자몽 청,30,,,
,,,자몽 과육,70,,,
,,,,,,,
블루베리 주스,5000,주스/에이드,물,190,,,
,,,블루베리 청,40,,,
,,,블루베리 과육,60,,,
,,,,,,,
블루베리 에이드,5500,주스/에이드,탄산수,1,,,
,,,블루베리 청,40,,,
,,,블루베리 과육,60,,,
,,,,,,,
매실 주스,5000,주스/에이드,물,190,,,
,,,매실 청,100,,,
,,,,,,,
매실 에이드,5500,주스/에이드,탄산수,1,,,
,,,매실 청,100,,,
,,,,,,,
오미자 주스,5000,주스/에이드,물,190,,,
,,,오미자 청,80,,,
,,,,,,,
오미자 에이드,5500,주스/에이드,탄산수,1,,,
,,,오미자 청,80,,,
,,,,,,,
생강레몬차,4500,차,생강레몬 코디얼,50,,50,
,,,대추 편,,,3,
,,,,,,,
생강차,4500,차,생강 코디얼,50,,50,
,,,대추 편,,,3,
,,,,,,,
유자차,4500,차,유자 코디얼,60,,60,
,,,대추 편,,,3,
,,,,,,,
오디차,4500,차,오디 코디얼,50,,50,
,,,대추 편,,,3,
,,,,,,,
오미자차,4500,차,오미자 청,,,50,
,,,대추 편,,,3,
,,,,,,,
매실차,4500,차,매실 청,,,50,
,,,대추 편,,,3,
,,,,,,,
아이스티,4000,차,수제 청 과육,40,,,
,,,아이스티,40,,,
,,,,,,,
밀크티,4900,차,밀크티 베이스,100,210,100,
,,,소스,10,20,10,
,,,우유,200,400,180,
Loading

0 comments on commit 6a3491e

Please sign in to comment.