feat: implement admin interface for managing custom movie sources and servers with new API endpoint and database schema updates

This commit is contained in:
ngthanhvu
2026-07-28 03:29:55 -04:00
parent 5ee45151ba
commit 72bc657d86
19 changed files with 1423 additions and 229 deletions
+28
View File
@@ -32,6 +32,34 @@ export default defineEventHandler(async (event) => {
: null
}
if ('actors' in body) {
updates.actors = Array.isArray(body.actors) && body.actors.length
? body.actors.filter((a: any) => a.name?.trim()).map((a: any) => ({
name: a.name.trim(),
originalName: a.originalName?.trim() || undefined,
role: a.role?.trim() || undefined,
avatar: a.avatar?.trim() || undefined,
}))
: null
}
if ('customServers' in body) {
updates.customServers = Array.isArray(body.customServers) && body.customServers.length
? body.customServers
.filter((server: any) => server.name?.trim())
.map((server: any) => ({
name: server.name.trim(),
episodes: Array.isArray(server.episodes)
? server.episodes.filter((ep: any) => ep.name?.trim()).map((ep: any) => ({
name: ep.name.trim(),
linkEmbed: ep.linkEmbed?.trim() || null,
linkM3u8: ep.linkM3u8?.trim() || null,
}))
: [],
}))
: null
}
if (!Object.keys(updates).length) {
throw createError({ statusCode: 400, message: 'Không có dữ liệu cập nhật' })
}