- 달다구리
+ {user.nickname}
🚀
- 235개
+ {startedCount}개
의 달을 여행했어요
🌕
- 175개
+ {completedCount}개
의 달에 도착했어요
👩🚀
- 175명
+ {friendCount}명
의 친구들과 여행했어요
diff --git a/app/(route)/me/queries.ts b/app/(route)/me/queries.ts
new file mode 100644
index 0000000..61a60f1
--- /dev/null
+++ b/app/(route)/me/queries.ts
@@ -0,0 +1,16 @@
+import { useQuery } from '@tanstack/react-query'
+
+import { getUserStatus } from '@/app/_service/auth'
+
+const QUERY_KEY = {
+ USER_STATUS: ['userStatus'],
+}
+
+export const useUserStatusQuery = () => {
+ return useQuery({
+ queryKey: QUERY_KEY.USER_STATUS,
+ queryFn: () => {
+ return getUserStatus()
+ },
+ })
+}
diff --git a/app/(route)/sign-up/page.tsx b/app/(route)/sign-up/page.tsx
index 9408d56..893456a 100644
--- a/app/(route)/sign-up/page.tsx
+++ b/app/(route)/sign-up/page.tsx
@@ -13,7 +13,7 @@ import { getKakaoAccessToken, removeKakaoAccessToken, setAccessToken } from '@/a
import { useLoginQuery, useSignUpMutation } from './queries'
-const CHAMPION = {
+export const CHAMPION = {
DEFAULT: {
RED: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/profile_red.png',
YELLOW: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/asset/profile_yellow.png',
diff --git a/app/_service/alarm/alarm.types.ts b/app/_service/alarm/alarm.types.ts
new file mode 100644
index 0000000..37c3950
--- /dev/null
+++ b/app/_service/alarm/alarm.types.ts
@@ -0,0 +1,8 @@
+export interface Alarm {
+ id: number
+ member_id: number
+ challenge_certification_id: number
+ alarm_type: 'REQUEST' | 'RE-REQUEST' | 'SUCCESS'
+ authenticateImageUrl: 'https://dodals3.s3.ap-northeast-2.amazonaws.com/1702758664871'
+ name: string
+}
diff --git a/app/_service/alarm/index.ts b/app/_service/alarm/index.ts
new file mode 100644
index 0000000..e24bbf9
--- /dev/null
+++ b/app/_service/alarm/index.ts
@@ -0,0 +1,15 @@
+import api from '../core/api'
+
+import { type Alarm } from './alarm.types'
+
+export const getAlarms = () => {
+ return api.get<{ alarms: Alarm[] }>('/alarms')
+}
+
+export const approveCertificationAlarm = ({ challengeCertificationId }: { challengeCertificationId: number }) => {
+ return api.post('/alarms/approve', { challengeCertificationId })
+}
+
+export const rejectCertificationAlarm = ({ challengeCertificationId }: { challengeCertificationId: number }) => {
+ return api.post('/alarms/reject', { challengeCertificationId })
+}
diff --git a/app/_service/auth/auth.types.ts b/app/_service/auth/auth.types.ts
index 89cab79..550f537 100644
--- a/app/_service/auth/auth.types.ts
+++ b/app/_service/auth/auth.types.ts
@@ -21,3 +21,9 @@ export interface SignUpParams {
nickname: string
champion: Champion
}
+
+export interface UserStatus {
+ completedCount: number
+ friendCount: number
+ startedCount: number
+}
diff --git a/app/_service/auth/index.ts b/app/_service/auth/index.ts
index 157d946..6db04c7 100644
--- a/app/_service/auth/index.ts
+++ b/app/_service/auth/index.ts
@@ -9,6 +9,7 @@ import {
type GetTokenFromKakaoParams,
type GetTokenFromKakaoResponse,
type SignUpParams,
+ type UserStatus,
} from './auth.types'
export const getTokenByAuthorizationCode = async ({ code }: GetTokenFromKakaoParams) => {
@@ -26,3 +27,7 @@ export const login = ({ accessToken }: { accessToken: string }) => {
export const signUp = ({ accessToken, nickname, champion }: SignUpParams) => {
return api.post('/users/signUp', { accessToken, nickname, champion })
}
+
+export const getUserStatus = () => {
+ return api.get
('/users/status')
+}
diff --git a/app/_service/challenge/challenge.types.ts b/app/_service/challenge/challenge.types.ts
index 598b752..4f5cc22 100644
--- a/app/_service/challenge/challenge.types.ts
+++ b/app/_service/challenge/challenge.types.ts
@@ -39,3 +39,17 @@ export interface Challenge {
}
export type GetChallengesResponse = Challenge[]
+
+export interface ChallengeDetail {
+ id: number
+ nickname: string
+ champion: Champion
+ participation_count: number
+ challenge_name: string
+ category: Category
+ reward: string
+}
+
+export type GetChallengeDetail = ChallengeDetail[] & {
+ myId: number
+}
diff --git a/app/_service/challenge/index.ts b/app/_service/challenge/index.ts
index e00ba7b..ae84469 100644
--- a/app/_service/challenge/index.ts
+++ b/app/_service/challenge/index.ts
@@ -7,6 +7,7 @@ import {
type GetUpcomingChallengeParams,
type GetUpcomingChallengeResponse,
type GetChallengesResponse,
+ type GetChallengeDetail,
} from './challenge.types'
export const getTodayStatus = () => {
@@ -47,3 +48,7 @@ export const submitCertification = ({ image, challengeId }: { image: File; chall
},
})
}
+
+export const getChallengeDetail = ({ challengeId }: { challengeId: number }) => {
+ return api.get(`/challenges/in-progress/${challengeId}`)
+}