Merge branch 'fe/fix/review-type' into 'fe/develop'

Fix: 리뷰 상태 값 수정

See merge request s11-s-project/S11P21S002!258
This commit is contained in:
홍창기 2024-10-02 10:55:25 +09:00
commit 048d73868d
11 changed files with 26 additions and 20 deletions

View File

@ -1,5 +1,5 @@
import api from '@/api/axiosConfig'; import api from '@/api/axiosConfig';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse } from '@/types'; import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus } from '@/types';
// 리뷰 단건 조회 // 리뷰 단건 조회
export async function getReviewDetail(projectId: number, reviewId: number, memberId: number) { export async function getReviewDetail(projectId: number, reviewId: number, memberId: number) {
@ -49,7 +49,7 @@ export async function getReviewByStatus(
projectId: number, projectId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
lastReviewId?: number, lastReviewId?: number,
limitPage: number = 10 limitPage: number = 10
) { ) {

View File

@ -5,6 +5,7 @@ import {
WorkspaceResponse, WorkspaceResponse,
ReviewResponse, ReviewResponse,
WorkspaceMemberResponse, WorkspaceMemberResponse,
ReviewStatus,
} from '@/types'; } from '@/types';
export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) { export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) {
@ -59,7 +60,7 @@ export async function getWorkspaceReviews(
workspaceId: number, workspaceId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
lastReviewId?: number, lastReviewId?: number,
limitPage: number = 10 limitPage: number = 10
) { ) {

View File

@ -2,13 +2,14 @@ import { Briefcase, Tag, Box, Layers } from 'lucide-react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import useProjectQuery from '@/queries/projects/useProjectQuery'; import useProjectQuery from '@/queries/projects/useProjectQuery';
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import { ReviewStatus } from '@/types';
interface ReviewItemProps { interface ReviewItemProps {
title: string; title: string;
createdTime: string; createdTime: string;
creatorName: string; creatorName: string;
projectId: number; projectId: number;
status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; status: ReviewStatus;
type?: { text: 'classification' | 'detection' | 'segmentation'; color: string }; type?: { text: 'classification' | 'detection' | 'segmentation'; color: string };
workspaceId: number; workspaceId: number;
reviewId: number; reviewId: number;

View File

@ -1,11 +1,11 @@
import ReviewItem from './ReviewItem'; import ReviewItem from './ReviewItem';
import ReviewSearchInput from './ReviewSearchInput'; import ReviewSearchInput from './ReviewSearchInput';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
interface ReviewListProps { interface ReviewListProps {
reviews: ReviewResponse[]; reviews: ReviewResponse[];
activeTab: 'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'; activeTab: ReviewStatus | 'all';
setActiveTab: React.Dispatch<React.SetStateAction<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'>>; setActiveTab: React.Dispatch<React.SetStateAction<ReviewStatus | 'all'>>;
setSearchQuery: React.Dispatch<React.SetStateAction<string>>; setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
sortValue: string; sortValue: string;
setSortValue: React.Dispatch<React.SetStateAction<string>>; setSortValue: React.Dispatch<React.SetStateAction<string>>;

View File

@ -1,5 +1,5 @@
import { http, HttpResponse } from 'msw'; import { http, HttpResponse } from 'msw';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatusRequest } from '@/types'; import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus, ReviewStatusRequest } from '@/types';
export const reviewHandlers = [ export const reviewHandlers = [
// 리뷰 단건 조회 핸들러 // 리뷰 단건 조회 핸들러
@ -145,7 +145,7 @@ export const reviewHandlers = [
reviewId: index + 1, reviewId: index + 1,
title: `Review ${index + 1}`, title: `Review ${index + 1}`,
content: `Review content ${index + 1}`, content: `Review content ${index + 1}`,
status: (reviewStatus || 'REQUESTED') as 'REQUESTED' | 'APPROVED' | 'REJECTED', status: (reviewStatus || 'REQUESTED') as ReviewStatus,
createAt: new Date().toISOString(), createAt: new Date().toISOString(),
updateAt: new Date().toISOString(), updateAt: new Date().toISOString(),
author: { id: 1, nickname: 'Author', profileImage: '', email: 'author@example.com' }, author: { id: 1, nickname: 'Author', profileImage: '', email: 'author@example.com' },

View File

@ -4,13 +4,14 @@ import useReviewByStatusQuery from '@/queries/reviews/useReviewByStatusQuery';
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList'; import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function ProjectReviewList() { export default function ProjectReviewList() {
const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>(); const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>();
const profile = useAuthStore((state) => state.profile); const profile = useAuthStore((state) => state.profile);
const memberId = profile?.id || 0; const memberId = profile?.id || 0;
const [activeTab, setActiveTab] = useState<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'>('REQUESTED'); const [activeTab, setActiveTab] = useState<ReviewStatus | 'all'>('REQUESTED');
const [, setSearchQuery] = useState(''); const [, setSearchQuery] = useState('');
const [sortValue, setSortValue] = useState('latest'); const [sortValue, setSortValue] = useState('latest');

View File

@ -111,7 +111,7 @@ export default function ReviewDetail(): JSX.Element {
)} )}
</div> </div>
{(reviewDetail.reviewStatus === 'APPROVED' || reviewDetail.reviewStatus === 'REJECTED') && ( {(reviewDetail.reviewStatus === 'APPROVED' || reviewDetail.reviewStatus === 'REJECT') && (
<div className="reviewer-info mt-6"> <div className="reviewer-info mt-6">
<h2 className="text-lg font-semibold"> <h2 className="text-lg font-semibold">
: {reviewDetail.reviewStatus === 'APPROVED' ? '승인됨' : '거부됨'} : {reviewDetail.reviewStatus === 'APPROVED' ? '승인됨' : '거부됨'}
@ -137,7 +137,7 @@ export default function ReviewDetail(): JSX.Element {
<Link to={`/admin/${workspaceId}/reviews`}> <Link to={`/admin/${workspaceId}/reviews`}>
<Button variant="black"> </Button> <Button variant="black"> </Button>
</Link> </Link>
{isAdminOrManager && reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && ( {isAdminOrManager && reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECT' && (
<> <>
<Button <Button
variant="red" variant="red"

View File

@ -4,13 +4,14 @@ import useWorkspaceReviewsQuery from '@/queries/workspaces/useWorkspaceReviewsQu
import useAuthStore from '@/stores/useAuthStore'; import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList'; import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function WorkspaceReviewList() { export default function WorkspaceReviewList() {
const { workspaceId } = useParams<{ workspaceId: string }>(); const { workspaceId } = useParams<{ workspaceId: string }>();
const profile = useAuthStore((state) => state.profile); const profile = useAuthStore((state) => state.profile);
const memberId = profile?.id || 0; const memberId = profile?.id || 0;
const [activeTab, setActiveTab] = useState<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'>('REQUESTED'); const [activeTab, setActiveTab] = useState<ReviewStatus | 'all'>('REQUESTED');
const [, setSearchQuery] = useState(''); const [, setSearchQuery] = useState('');
const [sortValue, setSortValue] = useState('latest'); const [sortValue, setSortValue] = useState('latest');

View File

@ -1,11 +1,11 @@
import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { getReviewByStatus } from '@/api/reviewApi'; import { getReviewByStatus } from '@/api/reviewApi';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
export default function useReviewByStatusQuery( export default function useReviewByStatusQuery(
projectId: number, projectId: number,
memberId: number, memberId: number,
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED' | undefined, reviewStatus: ReviewStatus | undefined,
sortDirection: number sortDirection: number
) { ) {
return useSuspenseInfiniteQuery<ReviewResponse[]>({ return useSuspenseInfiniteQuery<ReviewResponse[]>({

View File

@ -1,12 +1,12 @@
import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { getWorkspaceReviews } from '@/api/workspaceApi'; import { getWorkspaceReviews } from '@/api/workspaceApi';
import { ReviewResponse } from '@/types'; import { ReviewResponse, ReviewStatus } from '@/types';
export default function useWorkspaceReviewsQuery( export default function useWorkspaceReviewsQuery(
workspaceId: number, workspaceId: number,
memberId: number, memberId: number,
sortDirection: number, sortDirection: number,
reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', reviewStatus?: ReviewStatus,
limitPage: number = 10 limitPage: number = 10
) { ) {
return useSuspenseInfiniteQuery<ReviewResponse[]>({ return useSuspenseInfiniteQuery<ReviewResponse[]>({

View File

@ -1,6 +1,8 @@
import { ImageStatus } from './imageTypes'; import { ImageStatus } from './imageTypes';
import { MemberResponse } from './memberTypes'; import { MemberResponse } from './memberTypes';
export type ReviewStatus = 'REQUESTED' | 'APPROVED' | 'REJECT';
// 리뷰 관련 DTO // 리뷰 관련 DTO
export interface ReviewRequest { export interface ReviewRequest {
title: string; title: string;
@ -13,14 +15,14 @@ export interface ReviewResponse {
projectId: number; projectId: number;
title: string; title: string;
content: string; content: string;
status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; status: ReviewStatus;
author: MemberResponse; author: MemberResponse;
createAt: string; createAt: string;
updateAt: string; updateAt: string;
} }
export interface ReviewStatusRequest { export interface ReviewStatusRequest {
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; reviewStatus: ReviewStatus;
} }
export interface ReviewImageResponse { export interface ReviewImageResponse {
@ -35,7 +37,7 @@ export interface ReviewDetailResponse {
reviewId: number; reviewId: number;
title: string; title: string;
content: string; content: string;
reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; reviewStatus: ReviewStatus;
images: ReviewImageResponse[]; images: ReviewImageResponse[];
createAt: string; createAt: string;
updateAt: string; updateAt: string;