mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Working on posts
This commit is contained in:
@@ -44,6 +44,9 @@ export default class Post extends BaseModel {
|
||||
@column()
|
||||
public readingTime: number
|
||||
|
||||
@column()
|
||||
public date: string
|
||||
|
||||
@column.dateTime({ autoCreate: true })
|
||||
public createdAt: DateTime
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ export default class PostStoreValidator {
|
||||
title: schema.string(),
|
||||
description: schema.string(),
|
||||
cover: schema.string(),
|
||||
readingTime: schema.number()
|
||||
readingTime: schema.number(),
|
||||
date: schema.string(),
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
|
||||
@@ -10,7 +10,8 @@ export default class PostUpdateValidator {
|
||||
title: schema.string.optional(),
|
||||
description: schema.string.optional(),
|
||||
cover: schema.string.optional(),
|
||||
readingTime: schema.number.optional()
|
||||
readingTime: schema.number.optional(),
|
||||
date: schema.string.optional(),
|
||||
})
|
||||
public messages = {
|
||||
required: 'The field {{field}} is required'
|
||||
|
||||
@@ -8,6 +8,23 @@ export default class Posts extends BaseSchema {
|
||||
table.increments('id').primary()
|
||||
table.string('slug').notNullable()
|
||||
table.integer('likes').notNullable()
|
||||
table.integer('reading_time').notNullable()
|
||||
table.string('date').notNullable()
|
||||
table
|
||||
.integer('title_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table
|
||||
.integer('description_id')
|
||||
.unsigned()
|
||||
.references('translations.id')
|
||||
.onDelete('CASCADE')
|
||||
table
|
||||
.integer('title_id')
|
||||
.unsigned()
|
||||
.references('files.id')
|
||||
.onDelete('CASCADE')
|
||||
table.timestamps(true, true)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user