Skip to content

Commit

Permalink
Merge pull request #54 from gdsc-ssu/dev
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
Jun99uu authored Dec 16, 2023
2 parents beb36c2 + 5f10bec commit c66263d
Show file tree
Hide file tree
Showing 138 changed files with 6,825 additions and 285 deletions.
7 changes: 2 additions & 5 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
"plugins": [
"@typescript-eslint",
"prettier"
],
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"prettier/prettier": "error",
"react/react-in-jsx-scope": "off"
},
Expand Down
14 changes: 12 additions & 2 deletions client/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
const runtimeCaching = require('next-pwa/cache');
const withPWA = require('next-pwa')({
dest: 'public',
disable: process.env.NODE_ENV === 'development',
register: true,
skipWaiting: true,
runtimeCaching,
});

const nextConfig = withPWA({
reactStrictMode: false,
compiler: {
emotion: true,
},
Expand All @@ -14,6 +24,6 @@ const nextConfig = {

return config;
},
};
});

module.exports = nextConfig;
11 changes: 9 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"start": "next start",
"lint": "next lint",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"export": "next export"
},
"dependencies": {
"@emotion/react": "^11.11.1",
Expand All @@ -19,12 +20,16 @@
"@tanstack/react-query": "^4.36.1",
"@types/lodash": "^4.14.199",
"axios": "^1.5.1",
"embla-carousel-react": "^8.0.0-rc14",
"framer-motion": "^10.16.4",
"jotai": "^2.4.3",
"lodash": "^4.17.21",
"lottie-react": "^2.4.0",
"next": "^13.5.4",
"next-pwa": "^5.6.0",
"react": "latest",
"react-dom": "latest"
"react-dom": "latest",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/preset-env": "^7.22.20",
Expand All @@ -45,6 +50,7 @@
"@types/node": "20.7.2",
"@types/react": "^18.2.27",
"@types/react-dom": "^18.2.12",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"chromatic": "^7.4.0",
Expand All @@ -53,6 +59,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-storybook": "^0.6.14",
"next-compose-plugins": "^2.2.1",
"prettier": "^3.0.3",
"storybook": "^7.5.0-alpha.3",
"typescript": "latest"
Expand Down
Binary file added client/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/icons/icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/icons/icon-384x384.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/icons/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"theme_color": "#1d9bf0",
"background_color": "#1d9bf0",
"display": "fullscreen",
"scope": "/",
"start_url": "/",
"name": "\uc288\ub3c4\ube44",
"short_name": "\uc288\ub3c4\ube44",
"description": "\uc22d\uc2e4\ub300\ud559\uad50 \ub3c4\uc11c\uad00 \ube44\ub300\uba74 \uc608\uc57d \uc2dc\uc2a4\ud15c",
"icons": [
{
"src": "icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
Binary file added client/public/og.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/ipad_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/ipadpro1_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/ipadpro2_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/ipadpro3_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphone5_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphone6_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphoneplus_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphonex_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphonexr_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/splash/iphonexsmax_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions client/src/@types/Mate.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
declare module 'Mate' {
export type StudentIdResponse = {
id: number;
name: string;
memberNo: string;
alternativeId: string;
};

export type MateItemType = {
name?: string;
memberNo?: string;
info: {
name: string;
sId: string;
alternativeId: string;
};
id: number;
};
}
19 changes: 19 additions & 0 deletions client/src/@types/MyTemplate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MateItemType } from 'Mate';

export type UsageType = '학습' | '회의' | '기타' | '수업';

export type Seminartype = '개방형 세미나실' | '세미나실';

export interface MyTemplate {
uuid: string;
title: string;
day: string;
time: number;
usePerson: number;
startTime: string;
finishTime: string;
people: Array<MateItemType>;
seminarType: Seminartype;
semina: number[];
type: UsageType;
}
82 changes: 82 additions & 0 deletions client/src/@types/ReservationList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
interface Room {
id: number;
name: string;
useBeacon: boolean;
checkKiosk: boolean;
useDoorLock: boolean;
checkAccessGate: boolean;
checkAccessGPS: boolean;
roomGeoLocationInfo: string | null;
branchGroup: {
id: number;
name: string;
};
floor: number;
}

interface RoomType {
id: number;
code: string;
name: string;
order: number;
}

interface Patron {
name: string;
}

interface RoomReservationState {
id: number;
code: string;
name: string;
}

export interface PatronInfo {
name?: string;
memberNo?: string;
sId?: string;
info?: {
name: string;
sId: string;
};
}

interface RoomUseSection {
id: number;
code: string;
name: string;
}

export interface ReservationData {
success: boolean;
code: string;
message: string;
data: {
totalCount: number;
list: ReservationInfo[];
};
}

interface ReservationInfo {
id: number;
room: Room;
roomType: RoomType;
patron: Patron;
isMyReservation: boolean;
beginTime: string;
endTime: string;
patronCount: number;
patrons: PatronInfo[];
roomReservationState: RoomReservationState;
equipments: Array<string>; // 데이터가 없어서 빈 배열로 설정
dateCreated: string;
isEditable: boolean;
renewableRemainingTime: number;
renewalLimitCount: number;
renewalTime: number;
availableRenewal: boolean;
isCheckInTime: boolean;
checkInDateTime: string;
roomUseSection: RoomUseSection;
isAllDayOpen: boolean;
}
34 changes: 34 additions & 0 deletions client/src/@types/Template.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
declare module 'Template' {
export type WeekdayShort =
| 'Sun'
| 'Mon'
| 'Tue'
| 'Wed'
| 'Thu'
| 'Fri'
| 'Sat';
export type Patron = {
name: string;
sId: string;
id?: string;
memberNo?: string;
info?: {
name: string;
sId: string;
};
};
export type TemplateInfo = {
// template 제목
title: string;
day: WeekdayShort;
// template 시작 시간, 끝나는 시간
beginTime: string;
endTime: string;
// template 장소
place: number;
// template 메모
memo: string;
// template 동반이용자
friends: Array<Patron>;
};
}
40 changes: 40 additions & 0 deletions client/src/apis/ReserveData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ReservationData } from '@/@types/ReservationList';
import axios from 'axios';

export const getReservationData = async (AccessToken?: string) => {
const apiUrl = `${process.env.NEXT_PUBLIC_RESERVATION_CHECK}`;
const headers = {
Accept: 'application/json, text/plain, */*',
'pyxis-auth-token': `${AccessToken}`, //로그인 후 발급받은 토큰
};

const res = await axios.get<ReservationData>(apiUrl, { headers });

return res.data;
};

export const postReservationCancel = async (
reserveId?: number,
AccessToken?: string,
) => {
try {
const apiUrl = `${process.env.NEXT_PUBLIC_RESERVATION_CHECK}/${reserveId}/cancel?_method=delete`;
const headers = {
Accept: 'application/json;charset=UTF-8',
'pyxis-auth-token': `${AccessToken}`, //로그인 후 발급받은 토큰
};

// API 호출
await axios
.post(apiUrl, null, { headers })
.then((res) => {
console.log('res', res.data);
})
.catch((error) => {
console.error('Error fetching data:', error);
});
} catch (error) {
console.error('로그인 오류: ', error);
} finally {
}
};
29 changes: 29 additions & 0 deletions client/src/apis/auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getAccessToken } from '@/utils/lib/tokenHandler';
import { AuthData, AuthResponse } from 'Auth';
import axios, { AxiosResponse } from 'axios';

Expand All @@ -18,6 +19,34 @@ class AuthApi {

return data.data.data;
};
reservation = async (
room: string,
roomUseSection: number,
beginTime: string,
endTime: string,
patronIds: string[],
) => {
const requestBody = {
room: room /*세미나실 번호*/,
roomUseSection:
roomUseSection /*세미나실 사용 용도 1: 학습, 2:회의, 3:수업, 4:기타*/,
beginTime: beginTime, //'YYYY-MM-DD HH:MM'
endTime: endTime,
patronCount: patronIds.length /*동반 사용자 수 */,
alternativeIds: patronIds /*동반 사용자의 도서관 id 리스트*/,
};

const accessToken = getAccessToken();

const headers = {
Accept: 'application/json, text/plain, */*',
'pyxis-auth-token': `${accessToken}`,
};
const apiUrl = `${process.env.NEXT_PUBLIC_BASE_URL}pc/rooms/${room}/reserve`;
const response = await axios.post(apiUrl, requestBody, { headers });
const { data } = response;
return data;
};
}

export default AuthApi;
14 changes: 14 additions & 0 deletions client/src/apis/student.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Patron } from 'Template';
import { get } from './AxiosCreate';
import { StudentIdResponse } from 'Mate';

class StudentApi {
getStudentId = async (info: Patron): Promise<StudentIdResponse> => {
const res = await get<StudentIdResponse>(
`/patrons/${info.name}/${info.sId}`,
);
return res;
};
}

export default StudentApi;
1 change: 1 addition & 0 deletions client/src/assets/json/magnifying.json

Large diffs are not rendered by default.

Loading

0 comments on commit c66263d

Please sign in to comment.