mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24: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) => {
|
export default async (payload) => {
|
||||||
const { user_id, title, description, thumbnail, list } = 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({
|
const playlist = new Playlist({
|
||||||
user_id,
|
user_id,
|
||||||
created_at: Date.now(),
|
created_at: Date.now(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user