mirror of
https://github.com/ngthanhvu/kr-phim.git
synced 2026-08-10 16:07:47 +00:00
feat: implement admin interface for managing custom movie sources and servers with new API endpoint and database schema updates
This commit is contained in:
@@ -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' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user