d67d6eb2cd
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m40s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m40s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m15s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 4m3s
CI/CD Pipeline / Build Staging Web Image (push) Failing after 4m3s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 7m21s
CI/CD Pipeline / Build Staging API Image (push) Successful in 8m27s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (push) Has been skipped
CI/CD Pipeline / Unit Tests (push) Successful in 10m29s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 3m42s
CI/CD Pipeline / CI Gate (push) Has been skipped
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
/**
|
|
* 封面模板 CRUD API
|
|
* 后端路由: /api/v1/cover-templates
|
|
*/
|
|
import apiClient from "./client"
|
|
import type { CoverTemplate } from "@/pages/generate/types/cover"
|
|
|
|
export interface CoverTemplateListResponse {
|
|
items: CoverTemplate[]
|
|
total: number
|
|
}
|
|
|
|
export interface CoverTemplateCreateRequest {
|
|
name: string
|
|
config?: {
|
|
background_enabled?: boolean
|
|
background_color?: string
|
|
portrait_enabled?: boolean
|
|
title_text?: string
|
|
subtitle_text?: string
|
|
mask_enabled?: boolean
|
|
}
|
|
}
|
|
|
|
export type CoverTemplateUpdateRequest = Partial<CoverTemplateCreateRequest>
|
|
|
|
/** 获取封面模板列表 */
|
|
export async function fetchCoverTemplates(): Promise<CoverTemplateListResponse> {
|
|
const response = await apiClient.get<CoverTemplateListResponse>("/cover-templates")
|
|
return response.data
|
|
}
|
|
|
|
/** 创建封面模板 */
|
|
export async function createCoverTemplate(
|
|
data: CoverTemplateCreateRequest,
|
|
): Promise<CoverTemplate> {
|
|
const response = await apiClient.post<CoverTemplate>("/cover-templates", data)
|
|
return response.data
|
|
}
|
|
|
|
/** 更新封面模板 */
|
|
export async function updateCoverTemplate(
|
|
id: string,
|
|
data: CoverTemplateUpdateRequest,
|
|
): Promise<CoverTemplate> {
|
|
const response = await apiClient.put<CoverTemplate>(`/cover-templates/${id}`, data)
|
|
return response.data
|
|
}
|
|
|
|
/** 删除封面模板(系统模板不可删) */
|
|
export async function deleteCoverTemplate(id: string): Promise<void> {
|
|
await apiClient.delete(`/cover-templates/${id}`)
|
|
}
|