2

I have a schema like this:


    judul: schema.string(),
    ringkasan: schema.string(),
    tahun_terbit: schema.date({
      format: 'yyyy-MM-dd'
    }),
    halaman: schema.number(),
    kategori_id: schema.number([rules.exists({ table: 'categories', column: 'id' })])

I have controller to create after validate like this:

const books = await request.validate(BooksValidationValidator);
        
await Book.create(books)

in my case the problem was mysql couldn't save the data. i think the problem is in the date format. I've tried it with rfc2822, iso, and sql formats but it still doesn't work.

enter image description here

Badrudin
  • 31
  • 3

0 Answers0