Skip to content

Commit

Permalink
Merge pull request #339 from donga-it-club/develop
Browse files Browse the repository at this point in the history
[FE][Release] 240724 테스트 전 빌드
  • Loading branch information
yeneua authored Jul 23, 2024
2 parents bf58345 + 37d8fc7 commit 811c172
Show file tree
Hide file tree
Showing 35 changed files with 1,360 additions and 164 deletions.
22 changes: 22 additions & 0 deletions src/api/@types/Groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,25 @@ export interface GetRetrospectiveGroupNodes {
createdDate: Date;
updatedDate: Date;
}

// put - update group boards
export interface PutRetrospectiveGroupBoardRequest {
retrospectiveGroupId: number;
retrospectiveIds: number[];
}

export interface PutRetrospectiveGroupBoardResponse {
code: number;
message: string;
data: {
id: number;
title: string;
userId: number;
userName: string;
status: string;
isBookmarked: boolean;
thumbnail: string | null;
description: string;
updateDate: Date;
};
}
147 changes: 147 additions & 0 deletions src/api/@types/NoticeBoard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// get
// 게시글 목록 조회
export interface GetNoticeListRequest {
page: number;
size: number;
}

export interface GetNoticeListResponse {
code: number;
message: string;
data: GetNoticeListData;
}

export interface GetNoticeListData {
posts: GetNoticeListPosts[];
totalPages: number;
}

export interface GetNoticeListPosts {
id: number;
title: string;
content: string;
status: 'PUBLISHED';
createdDate: string;
modifiedDate: string;
views: number;
}

// 개별 게시글 조회
export interface GetNoticePostsRequest {
id: number;
}

export interface GetNoticePostsResponse {
code: number;
message: string;
data: GetNoticePostsData;
}

export interface GetNoticePostsData {
title: string;
content: string;
status: string;
createdDate: string;
modifiedDate: string;
views: number;
}

//post
export interface PostNoticeRequest {
title: string;
content: string;
status: 'PUBLISHED' | 'TEMP';
}

export interface PostNoticeResponse {
code: number;
message: string;
data: PostNoticeData;
}

export interface PostNoticeData {
title: string;
content: string;
status: string;
createdDate: string;
modifiedDate: string;
views: number;
}

export interface PostNoticeTempPostsRequest {
title: string;
content: string;
}

export interface PostNoticeTempPostsResponse {
code: number;
message: string;
data: PostNoticeTempPostsData;
}

export interface PostNoticeTempPostsData {
title: string;
content: string;
status: string;
createdDate: string;
modifiedDate: string;
views: number;
}

export interface PostNoticePresignedURLRequest {
filename: string;
method: 'GET' | 'PUT';
}

export interface PostNoticePresignedURLResponse {
code: number;
message: string;
data: PostNoticePresignedURLData;
}

export interface PostNoticePresignedURLData {
filename: string;
preSignedUrl: string;
}

// put
export interface PutNoticeRequest {
id: number;
title: string;
content: string;
status: string;
}

export interface PutNoticeResponse {
code: number;
message: string;
data: PutNoticeData;
}

export interface PutNoticeData {
title: string;
content: string;
status: string;
createdDate: string;
modifiedDate: string;
views: number;
}

// delete
export interface DeleteNoticeRequest {
id: number;
}

// export interface DeleteNoticeResponse {
// code: number;
// }

export interface NoticeBoardClient {
listGet(request: GetNoticeListRequest): Promise<GetNoticeListResponse>;
postsGet(request: GetNoticePostsRequest): Promise<GetNoticePostsResponse>;
create(request: PostNoticeRequest): Promise<PostNoticeResponse>;
tempSave(request: PostNoticeTempPostsRequest): Promise<PostNoticeTempPostsResponse>;
Img(request: PostNoticePresignedURLRequest): Promise<PostNoticePresignedURLResponse>;
revise(request: PutNoticeRequest): Promise<PutNoticeResponse>;
delete(request: DeleteNoticeRequest): Promise<void>;
}
1 change: 1 addition & 0 deletions src/api/@types/Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface PostSurveyRequest {
region: string;
source: string;
purposes: string[] | undefined;
emailConsents: boolean;
}

export interface PostSurveyResponse {
Expand Down
6 changes: 6 additions & 0 deletions src/api/@types/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ export interface PutUsersResponse {
username: string;
};
}

// // post
// export interface PostUserRequest {
// email: string;
// admin: boolean;
// }
3 changes: 3 additions & 0 deletions src/api/@types/Users.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// get
export interface GetUserResponse {
code: number;
message: string;
Expand All @@ -12,8 +13,10 @@ export interface UserData {
phone: string;
createdDate: string;
updatedDate: string;
administrator: boolean;
}

// post
export interface PostAdminRequest {
email: string;
admin: boolean;
Expand Down
14 changes: 14 additions & 0 deletions src/api/retroGroupsApi/putBoard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PutRetrospectiveGroupBoardRequest, PutRetrospectiveGroupBoardResponse } from '../@types/Groups';
import axiosInstance from '@/api/axiosConfig';

export const putBoard = async ({
retrospectiveGroupId,
...request
}: PutRetrospectiveGroupBoardRequest): Promise<PutRetrospectiveGroupBoardResponse> => {
try {
const response = await axiosInstance.put(`/retrospectiveGroups/${retrospectiveGroupId}/boards`, request);
return response.data;
} catch (error) {
throw new Error(error as string);
}
};
3 changes: 0 additions & 3 deletions src/api/retrospectivesApi/getRetrospective.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ export const queryGetRetrospective = async (requestData: GetRetrospectiveRequest
params.keyword = keyword;
}

console.log(params);
const response = await axiosInstance.get<GetRetrospectiveData>('/retrospectives', {
params,
});
// console.log('회고 get 성공', response.data);
return response.data;
} catch (error) {
// console.log('회고 get 실패', error);
throw new Error('회고 get 실패');
}
};
80 changes: 80 additions & 0 deletions src/api/services/NoticeBoard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import {
GetNoticeListRequest,
GetNoticeListResponse,
NoticeBoardClient,
PostNoticeRequest,
PostNoticeResponse,
PostNoticeTempPostsRequest,
PostNoticeTempPostsResponse,
PostNoticePresignedURLRequest,
PostNoticePresignedURLResponse,
PutNoticeResponse,
DeleteNoticeRequest,
GetNoticePostsRequest,
GetNoticePostsResponse,
} from '../@types/NoticeBoard';
import axiosInstance from '../axiosConfig';

const ROUTE = 'admin/notices';

export const NoticeServices: NoticeBoardClient = {
listGet: async (request: GetNoticeListRequest): Promise<GetNoticeListResponse> => {
try {
const response = await axiosInstance.get<GetNoticeListResponse>(`/posts`, { params: request });
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
postsGet: async ({ id }: GetNoticePostsRequest): Promise<GetNoticePostsResponse> => {
try {
const response = await axiosInstance.get<GetNoticePostsResponse>(`/posts/${id}`);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
create: async (request: PostNoticeRequest): Promise<PostNoticeResponse> => {
try {
const response = await axiosInstance.post<PostNoticeResponse>(`${ROUTE}/posts`, request);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
tempSave: async (request: PostNoticeTempPostsRequest): Promise<PostNoticeTempPostsResponse> => {
try {
const response = await axiosInstance.post<PostNoticeTempPostsResponse>(`${ROUTE}/temp-posts`, request);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
Img: async (request: PostNoticePresignedURLRequest): Promise<PostNoticePresignedURLResponse> => {
try {
const response = await axiosInstance.post<PostNoticePresignedURLResponse>(
`${ROUTE}/files/presigned-url`,
request,
);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
revise: async ({ id, ...request }): Promise<PutNoticeResponse> => {
try {
const response = await axiosInstance.put<PutNoticeResponse>(`${ROUTE}/posts/${id}`, request);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
delete: async ({ id }: DeleteNoticeRequest): Promise<void> => {
try {
const response = await axiosInstance.delete(`${ROUTE}/posts/${id}`);
return response.data;
} catch (error) {
throw new Error(error as string);
}
},
};
2 changes: 1 addition & 1 deletion src/api/services/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const UserServices: UserClient = {
throw new Error(error as string);
}
},
adminPost: async (request: PostAdminRequest) => {
adminPost: async (request: PostAdminRequest): Promise<void> => {
try {
const response = await axiosInstance.post(`/${ROUTE}/me/admin-status`, request);
return response.data;
Expand Down
6 changes: 5 additions & 1 deletion src/components/Main/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ const Contact: React.FC = () => {
<S.TextContainer>
<S.EmailContainer>
<S.EmailTitle>Email</S.EmailTitle>
<S.EmailInput placeholder="이메일을 입력해주세요" value={email} onChange={handleEmailChange}></S.EmailInput>
<S.EmailInput
placeholder="문의 답변을 받을 이메일을 입력해주세요"
value={email}
onChange={handleEmailChange}
></S.EmailInput>
</S.EmailContainer>

<S.SubjectContainer>
Expand Down
4 changes: 1 addition & 3 deletions src/components/RetroList/ContentsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ const ContentList: React.FC<ContentListProps> = ({ data, viewMode, searchData, s
const requestData: PatchRetrospectiveRequest = {
retrospectiveId: itemId,
};
const response = await patchRetrospective(requestData);
console.log('북마크 patch 요청 완료', response);
await patchRetrospective(requestData);
setBookmarkUpdate(prev => !prev);
} catch (error) {
// console.error('북마크 patch 요청 실패:', error);
toast.error(error);
}
};
Expand Down
Loading

0 comments on commit 811c172

Please sign in to comment.