validate types

This commit is contained in:
srgooglo 2022-11-12 08:58:29 +00:00
parent 8f903245a8
commit 426eb7b47e

View File

@ -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(),