Commit 52cef1e1 authored by Alexandros Georgantas's avatar Alexandros Georgantas

fix(datamodel): target property added

parent ba558f13
......@@ -272,6 +272,10 @@ const schema = {
type: 'integer',
exclusiveMinimum: 0,
},
targetType: {
type: 'string',
enum: ['epub', 'pagedjs', 'vivliostyle'],
},
language: {
regexp: {
pattern: langIsoRegex,
......
......@@ -8,11 +8,10 @@ create table template (
-- editoria base
deleted boolean default false,
--foreign
book_id uuid references book,
reference_id uuid,
author text,
thumbnail_id uuid references file,
templateName text not null
target string,
files text[],
);
\ No newline at end of file
const { Model } = require('./node_modules/objection')
const Base = require('../editoriaBase')
const { arrayOfIds, id, stringNotEmpty, string } = require('../helpers').schema
const { arrayOfIds, id, stringNotEmpty, string, targetType } = require('../helpers').schema
class Template extends Base {
constructor(properties) {
......@@ -22,8 +22,8 @@ class Template extends Base {
referenceId: id,
author: string,
thumbnailId: id,
bookId: id,
files: arrayOfIds,
target: targetType,
},
}
}
......@@ -54,6 +54,9 @@ class Template extends Base {
getFiles() {
return this.$relatedQuery('files')
}
getThumbnail() {
return this.$relatedQuery('thumbnail')
}
}
module.exports = Template
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment