게시물 Export ZIP 생성 연결 v1.5.22
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { readBody } from 'h3'
|
||||
import { z } from 'zod'
|
||||
import { requireAdminSession } from '../../../../utils/admin-auth'
|
||||
import { createPostExportJob } from '../../../../repositories/post-export-repository'
|
||||
import {
|
||||
createPostExportJob,
|
||||
queuePostExportJobRun
|
||||
} from '../../../../repositories/post-export-repository'
|
||||
|
||||
const postExportJobInputSchema = z.object({
|
||||
chunkSize: z.number().int().min(1).max(500).optional(),
|
||||
@@ -17,11 +20,17 @@ export default defineEventHandler(async (event) => {
|
||||
const adminSession = requireAdminSession(event)
|
||||
const input = postExportJobInputSchema.parse(await readBody(event))
|
||||
|
||||
return createPostExportJob({
|
||||
const job = await createPostExportJob({
|
||||
requestedBy: adminSession.userId,
|
||||
requestedEmail: adminSession.email,
|
||||
scope: 'all',
|
||||
chunkSize: input.chunkSize,
|
||||
retentionDays: input.retentionDays
|
||||
})
|
||||
|
||||
if (job.status === 'queued') {
|
||||
queuePostExportJobRun(job.id)
|
||||
}
|
||||
|
||||
return job
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user