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