Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hanagertrudeKim committed May 10, 2024
2 parents 96c86f1 + 07de92d commit 33bdf5c
Show file tree
Hide file tree
Showing 187 changed files with 6,621 additions and 1,294 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/CHECK_PR_MERGED.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
pull_request:
types: closed

jobs:
check_pr_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check PR Merged
id: check_pr_merged
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prUrl = context.payload.pull_request.html_url ?? context.payload.pull_request._links.html.href;
core.setOutput('pullRequestLink', JSON.stringify(prUrl));
- name: Send Slack Trigger
run: |
curl -X POST https://api-slack.internal.bcsdlab.com/api/pr-merged/frontend \
-H 'Content-Type: application/json' \
-d '{
"pullRequestLink": ${{ steps.check_pr_merged.outputs.pullRequestLink }}
}'
269 changes: 269 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-21ad2b1333-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/gtag.js": "^0.0.19",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"assert": "^2.1.0",
"axios": "^1.3.4",
"dayjs": "^1.11.10",
"html-react-parser": "^5.1.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.9",
"react-quill": "^2.0.0",
"react-router-dom": "^6.9.0",
"react-scripts": "5.0.1",
"react-toastify": "^10.0.4",
Expand Down
8 changes: 7 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>코인 - 사장님용</title>
<title>코인 - 비즈니스</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=%REACT_APP_NAVER_MAPS_CLIENT_ID%"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '%REACT_APP_GOOGLE_ANALYTICS_ID%');
</script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
79 changes: 62 additions & 17 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,89 @@
import { Routes, Route } from 'react-router-dom';
import DefaultLayout from 'layout/DefaultLayout';
import {
Routes, Route, Navigate, Outlet,
} from 'react-router-dom';
import OwnerLayout from 'layout/OwnerLayout';
import CoopLayout from 'layout/CoopLayout';
import Login from 'page/Auth/Login';
import Signup from 'page/Auth/Signup';
import FindPassword from 'page/Auth/FindPassword/SendAuthNumber';
import NewPassword from 'page/Auth/FindPassword/NewPassword';
import CompleteChangePassword from 'page/Auth/FindPassword/CompleteChangePassword';
import AuthLayout from 'layout/AuthLayout';
import MyStorePage from 'page/MyShopPage';
import MyShopPage from 'page/MyShopPage';
import ShopRegistration from 'page/ShopRegistration';
import AddMenu from 'page/AddMenu';
import PageNotFound from 'page/Error/PageNotFound';
import ModifyMenu from 'page/ModifyMenu';
import { Suspense } from 'react';
import Toast from 'component/common/Toast';
import { UserType } from 'model/auth';
import Coop from 'page/Coop';
import useUserTypeStore from 'store/useUserTypeStore';
import AddingEvent from 'page/ManageEvent/AddingEvent';
import ModifyEvent from 'page/ManageEvent/ModifyEvent';
import LogPage from 'component/common/PageLog';

interface ProtectedRouteProps {
userTypeRequired: UserType;
}

function ProtectedRoute({ userTypeRequired }: ProtectedRouteProps) {
const { userType, updateUserType } = useUserTypeStore();
updateUserType();

if (userType !== userTypeRequired) {
if (userType === 'OWNER') {
return <Navigate to="/owner" replace />;
}
if (userType === 'COOP') {
return <Navigate to="/coop" replace />;
}
if (userType === null) {
return <Navigate to="/login" replace />;
}
}

return <Outlet />;
}

function App() {
return (
<Suspense fallback={<div />}>
<Routes>
<Route path="/" element={<DefaultLayout />}>
<Route path="/" element={<MyStorePage />} />
<Route path="/store-registration" element={<ShopRegistration />} />
<Route path="/add-menu" element={<AddMenu />} />
<Route path="/modify-menu/:menuId" element={<ModifyMenu />} />
<Route path="/modify-info" element={<PageNotFound />} />
<Route path="/menu-management" element={<PageNotFound />} />
<Route path="/order-management" element={<PageNotFound />} />
<Route path="/sales-management" element={<PageNotFound />} />
<Route path="/shop-add" element={<PageNotFound />} />
<Route path="/" element={<Navigate to="/owner" />} />
<Route element={<ProtectedRoute userTypeRequired="OWNER" />}>
<Route path="/owner" element={<OwnerLayout />}>
<Route path="/owner" element={<MyShopPage />} />
<Route path="/owner/shop-registration" element={<ShopRegistration />} />
<Route path="/owner/add-menu" element={<AddMenu />} />
<Route path="/owner/modify-menu/:menuId" element={<ModifyMenu />} />
<Route path="/owner/modify-info" element={<PageNotFound />} />
<Route path="/owner/menu-management" element={<PageNotFound />} />
<Route path="/owner/order-management" element={<PageNotFound />} />
<Route path="/owner/sales-management" element={<PageNotFound />} />
<Route path="/owner/event-add/:id" element={<AddingEvent />} />
<Route path="/owner/event-modify/:id" element={<ModifyEvent />} />
</Route>
</Route>
<Route element={<ProtectedRoute userTypeRequired="COOP" />}>
<Route path="/coop" element={<CoopLayout />}>
<Route path="/coop" element={<Coop />} />
</Route>
</Route>

<Route element={<AuthLayout />}>
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route path="/find-id" element={<PageNotFound />} />
<Route path="/find-password" element={<FindPassword />} />
<Route element={<ProtectedRoute userTypeRequired={null} />}>
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route path="/find-id" element={<PageNotFound />} />
<Route path="/find-password" element={<FindPassword />} />
</Route>
<Route path="/new-password" element={<NewPassword />} />
<Route path="/complete-change-password" element={<CompleteChangePassword />} />
</Route>
</Routes>
<Toast />
<LogPage />
</Suspense>
);
}
Expand Down
18 changes: 11 additions & 7 deletions src/api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { accessClient, client } from 'api';
import { LoginParams, LoginResponse, UserResponse } from 'model/auth';
// import {
// LoginParams, LoginResponse, UserResponse,
// } from 'api/auth/model';
import {
LoginParams, LoginResponse, OwnerResponse, UserTypeResponse,
} from 'model/auth';

export const postLogin = async (param: LoginParams) => {
const { data } = await client.post<LoginResponse>('/user/login', param);
Expand All @@ -11,9 +10,14 @@ export const postLogin = async (param: LoginParams) => {

export const postLogout = () => accessClient.post('/user/logout');

export const getMe = async () => {
const { data } = await accessClient.get<UserResponse>('/owner');
return UserResponse.parse(data);
export const getUserType = async () => {
const { data } = await accessClient.get<UserTypeResponse>('/user/auth');
return UserTypeResponse.parse(data);
};

export const getOwnerInfo = async () => {
const { data } = await accessClient.get<OwnerResponse>('/owner');
return OwnerResponse.parse(data);
};

export const findPasswordVerify = ({ email }: { email: string }) => client.post('/owners/password/reset/verification', { address: email });
Expand Down
6 changes: 3 additions & 3 deletions src/api/category/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { accessClient } from 'api';
import { StoreCategory } from 'model/category/storeCategory';
import { ShopCategory } from 'model/category/shopCategory';

const getShopCategory = async () => {
const { data } = await accessClient.get<StoreCategory>('/shops/categories');
return StoreCategory.parse(data);
const { data } = await accessClient.get<ShopCategory>('/shops/categories');
return ShopCategory.parse(data);
};

export default getShopCategory;
20 changes: 20 additions & 0 deletions src/api/coop/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { accessClient } from 'api';
import { CoopResponse, DiningImages, SoldOut } from 'model/Coop';

export const getDining = async (date: string) => {
const { data } = await accessClient.get(`/dinings?date=${date}`);
return data;
};

export const uploadDiningImage = async (data: DiningImages) => {
await accessClient.patch<DiningImages>('/coop/dining/image', data);
};

export const updateSoldOut = async (data: SoldOut) => {
await accessClient.patch<SoldOut>('/coop/dining/soldout', data);
};

export const getCoopInfo = async () => {
const { data } = await accessClient.get<CoopResponse>('/user/coop/me');
return CoopResponse.parse(data);
};
22 changes: 21 additions & 1 deletion src/api/shop/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { MyShopListRes, MyShopInfoRes, MyShopParam } from 'model/shopInfo/myShopInfo';
import {
MyShopListRes, MyShopInfoRes, MyShopParam, EventListParam, ShopEventResponse,
} from 'model/shopInfo/myShopInfo';
import { MonoMenu, MenuInfoRes } from 'model/shopInfo/menuCategory';
import { ShopListRes } from 'model/shopInfo/allShopInfo';
import { accessClient, client } from 'api';
import { OwnerShop } from 'model/shopInfo/ownerShop';
import { NewMenu } from 'model/shopInfo/newMenu';
import { EventInfo } from 'model/shopInfo/event';

export const getMyShopList = async () => {
const { data } = await accessClient.get<MyShopListRes>('/owner/shops');
Expand Down Expand Up @@ -39,3 +42,20 @@ export const modifyMenu = (menuId:number, param:NewMenu) => accessClient.put(`/o
export const putShop = (id: number, data: OwnerShop) => accessClient.put(`/owner/shops/${id}`, data);

export const deleteMenu = (menuId:number) => accessClient.delete(`/owner/shops/menus/${menuId}`);

export const getShopEventList = async (param : EventListParam) => {
const { data } = await accessClient.get<ShopEventResponse>(`/owner/shops/${param.id}/event`);
return ShopEventResponse.parse(data);
};
export const addEvent = (id: string, eventInfo: EventInfo) => accessClient.post(`owner/shops/${id}/event`, eventInfo);

export const deleteEvent = (shopId: number, eventId:number) => accessClient.delete(`owner/shops/${shopId}/events/${eventId}`);

export const modifyEvent = (
shopId: number,
eventId: number,
eventInfo: EventInfo,
) => accessClient.put(
`/owner/shops/${shopId}/events/${eventId}`,
eventInfo,
);
14 changes: 14 additions & 0 deletions src/api/uploadFile/Uploadfile.ts → src/api/uploadFile/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import { accessClient } from 'api';

interface File {
content_length: number;
content_type: string;
file_name: string;
}

export interface FileResponse {
pre_signed_url: string;
file_url: string;
expiration_date: string;
}

export const uploadFile = (formData: FormData) => accessClient.post('/OWNERS/upload/file', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
}).catch((error) => Promise.reject(error));

export const uploadFiles = (formData: FormData) => accessClient.post('/OWNERS/upload/files', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});

export const getCoopUrl = (fileName: File) => accessClient.post<FileResponse>('/coop/upload/url', fileName);
3 changes: 3 additions & 0 deletions src/assets/svg/common/cancel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svg/common/checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svg/common/picture-disable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svg/common/picture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 33bdf5c

Please sign in to comment.