mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
validate types
This commit is contained in:
parent
8f903245a8
commit
426eb7b47e
@ -3,6 +3,14 @@ import { Playlist } from "../../../models"
|
||||
export default async (payload) => {
|
||||
const { user_id, title, description, thumbnail, list } = payload
|
||||
|
||||
if (!title) {
|
||||
throw new Error("Title is required")
|
||||
}
|
||||
|
||||
if (!Array.isArray(list)) {
|
||||
throw new Error("list is not an array")
|
||||
}
|
||||
|
||||
const playlist = new Playlist({
|
||||
user_id,
|
||||
created_at: Date.now(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user