Files
jaejadle/nextjs/lib/services/disciple.ts
Mayne0213 f78454c2a1
Some checks failed
Build Docker Image / build-and-push (push) Has been cancelled
CI / lint-and-build (push) Has been cancelled
CHORE(merge): merge from develop
- Initial setup and all features from develop branch
- Includes: auth, deploy, docker, style fixes
- K3S deployment configuration
2026-01-06 17:29:16 +09:00

64 lines
1.5 KiB
TypeScript

import { apiGet, apiPost, apiDelete, apiPut } from "@/lib/api";
import { API_ENDPOINTS } from "@/const";
export interface DiscipleVideo {
id: number;
stage: string;
step: string | null;
videoUrl: string;
order: number;
createdAt: string;
updatedAt: string;
thumbnailUrl?: string;
embedUrl?: string;
}
export interface DiscipleVideoData {
stage: string;
step?: string | null;
videoUrl: string;
}
interface DiscipleReorderData {
videoId1: number;
videoId2: number;
}
/**
* 모든 제자훈련 영상 가져오기
*/
export async function getAllDiscipleVideos(): Promise<DiscipleVideo[]> {
return apiGet<DiscipleVideo[]>(API_ENDPOINTS.DISCIPLE.BASE);
}
/**
* 특정 stage의 영상들 가져오기
*/
export async function getDiscipleVideosByStage(stage: string): Promise<DiscipleVideo[]> {
return apiGet<DiscipleVideo[]>(API_ENDPOINTS.DISCIPLE.BY_STAGE(stage));
}
/**
* 영상 생성
*/
export async function createDiscipleVideo(data: DiscipleVideoData): Promise<DiscipleVideo> {
return apiPost<DiscipleVideo>(API_ENDPOINTS.DISCIPLE.BASE, data);
}
/**
* 영상 삭제
*/
export async function deleteDiscipleVideo(id: number): Promise<void> {
return apiDelete<void>(API_ENDPOINTS.DISCIPLE.BY_ID(id));
}
/**
* 영상 순서 변경 (두 비디오의 순서를 교환)
*/
export async function swapDiscipleVideos(videoId1: number, videoId2: number): Promise<DiscipleVideo[]> {
return apiPut<DiscipleVideo[], DiscipleReorderData>(
API_ENDPOINTS.DISCIPLE.REORDER,
{ videoId1, videoId2 }
);
}