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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import { http, HttpResponse } from 'msw';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatusRequest } from '@/types';
import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus, ReviewStatusRequest } from '@/types';
export const reviewHandlers = [
// 리뷰 단건 조회 핸들러
@ -145,7 +145,7 @@ export const reviewHandlers = [
reviewId: index + 1,
title: `Review ${index + 1}`,
content: `Review content ${index + 1}`,
status: (reviewStatus || 'REQUESTED') as 'REQUESTED' | 'APPROVED' | 'REJECTED',
status: (reviewStatus || 'REQUESTED') as ReviewStatus,
createAt: new Date().toISOString(),
updateAt: new Date().toISOString(),
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 ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function ProjectReviewList() {
const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>();
const profile = useAuthStore((state) => state.profile);
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 [sortValue, setSortValue] = useState('latest');

View File

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

View File

@ -4,13 +4,14 @@ import useWorkspaceReviewsQuery from '@/queries/workspaces/useWorkspaceReviewsQu
import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button';
import { ReviewStatus } from '@/types';
export default function WorkspaceReviewList() {
const { workspaceId } = useParams<{ workspaceId: string }>();
const profile = useAuthStore((state) => state.profile);
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 [sortValue, setSortValue] = useState('latest');

View File

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

View File

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

View File

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