Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/apis/draftLetters.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import client from './client';

export interface DraftLetter {
letterId: number;
matchingId: number;
receiverId: number;
parentLetterId: number;
title: string;
content: string;
category: string;
paperType: string;
fontType: string;
}

export const getDraftLetters = async (): Promise<DraftLetter[]> => {
try {
const { data } = await client.get('/api/letters?status=draft');
Expand Down
64 changes: 0 additions & 64 deletions src/apis/share.ts
Original file line number Diff line number Diff line change
@@ -1,69 +1,5 @@
import client from './client';

//공유 게시글 상세 페이지 편지
interface ShareLetter {
id: number;
content: string;
writerZipCode: string;
receiverZipCode: string;
}

// 공유 게시글 목록 조회 타입
export interface SharePost {
writerZipCode: string;
receiverZipCode: string;
content: string;
createdAt: string;
active: boolean;
sharePostId: number;
sharePostContent: string;
zipCode: string;
letters: ShareLetter[];
}

// 공유 게시글 목록 조회 - 페이징 포함
export interface SharePostResponse {
content: SharePost[];
currentPage: number;
size: number;
totalElements: number;
totalPages: number;
}

// 편지 공유 요청 수신 조회
export interface ShareProposal {
shareProposalId: number;
requesterZipCode: string;
recipientZipCode: string;
message: string;
status: 'REJECTED' | 'APPROVED' | 'PENDING';
}

//편지 공유 요청 상세 조회
export interface ShareProposalLetter {
id: number;
content: string;
writerZipCode: string;
receiverZipCode: string;
createdAt: string;
}

export interface ShareProposalDetail {
shareProposalId: number;
requesterZipCode: string;
recipientZipCode: string;
message: string;
status: 'PENDING' | 'ACCEPTED' | 'REJECTED';
letters: ShareProposalLetter[];
}

// 편지 공유 수락 / 거절
export interface ShareProposalApproval {
shareProposalId: number;
status: 'APPROVED' | 'REJECTED';
sharePostId: number;
}

// 공유 게시글 목록 조회
export const getSharePostList = async (page: number = 1, size: number = 10) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Home/components/ShowDraftModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import DeleteOutlineRoundedIcon from '@mui/icons-material/DeleteOutlineRounded';
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router';

import { DraftLetter, getDraftLetters, deleteDraftLetters } from '@/apis/draftLetters';
import { getDraftLetters, deleteDraftLetters } from '@/apis/draftLetters';
import ModalBackgroundWrapper from '@/components/ModalBackgroundWrapper';
import ModalOverlay from '@/components/ModalOverlay';

Expand Down
1 change: 0 additions & 1 deletion src/pages/Home/components/ShowShareAccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useNavigate } from 'react-router';

import { getShareProposalDetail } from '@/apis/share';
import { getShareProposalList } from '@/apis/share';
import { ShareProposal } from '@/apis/share';

import ModalBackgroundWrapper from '@/components/ModalBackgroundWrapper';
import ModalOverlay from '@/components/ModalOverlay';
Expand Down
4 changes: 0 additions & 4 deletions src/pages/LetterBoardDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { twMerge } from 'tailwind-merge';

import {
getSharePostDetail,
SharePost,
getSharePostLikeCount,
postSharePostLike,
deleteSharePost,
Expand All @@ -24,9 +23,6 @@ const LetterBoardDetailPage = () => {
const [isWriter, setIsWriter] = useState(false);
const [postDetail, setPostDetail] = useState<SharePost>();
const [activeReportModal, setActiveReportModal] = useState(false);
// const location = useLocation();
// const sharePostId: string = location.pathname.split('/')[3];
// const isShareLetterPreview = location.state?.isShareLetterPreview || false;

const { id } = useParams();
const myZipCode = useAuthStore.getState().zipCode;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Share/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router';

import { getShareProposalDetail } from '@/apis/share';
import { postShareProposalApproval, ShareProposalDetail } from '@/apis/share';
import { postShareProposalApproval } from '@/apis/share';

import useToastStore from '@/stores/toastStore';

Expand Down
11 changes: 11 additions & 0 deletions src/types/draftLetters.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
interface DraftLetter {
letterId: number;
matchingId: number;
receiverId: number;
parentLetterId: number;
title: string;
content: string;
category: string;
paperType: string;
fontType: string;
}
36 changes: 35 additions & 1 deletion src/types/share.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,49 @@ interface SharePost {
active: boolean;
sharePostId: number;
sharePostContent: string;
zipCode: string;
letters: ShareLetter[];
}

// 페이징 포함
interface SharePostResponse {
// data: any;
content: SharePost[];
currentPage: number;
size: number;
totalElements: number;
totalPages: number;
}

// 편지 공유 요청 수신 조회
interface ShareProposal {
shareProposalId: number;
requesterZipCode: string;
recipientZipCode: string;
message: string;
status: 'REJECTED' | 'APPROVED' | 'PENDING';
}

//편지 공유 요청 상세 조회
interface ShareProposalLetter {
id: number;
content: string;
writerZipCode: string;
receiverZipCode: string;
createdAt: string;
}

interface ShareProposalDetail {
shareProposalId: number;
requesterZipCode: string;
recipientZipCode: string;
message: string;
status: 'PENDING' | 'ACCEPTED' | 'REJECTED';
letters: ShareProposalLetter[];
}

// 편지 공유 수락 / 거절
interface ShareProposalApproval {
shareProposalId: number;
status: 'APPROVED' | 'REJECTED';
sharePostId: number;
}