2021-06-24 18:28:36 +02:00
|
|
|
'use strict';
|
|
|
|
const category = {
|
|
|
|
modelName: 'category',
|
|
|
|
uid: 'category',
|
|
|
|
collectionName: 'categories',
|
|
|
|
attributes: {
|
|
|
|
title: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
price: {
|
|
|
|
type: 'integer',
|
|
|
|
//
|
|
|
|
column: {
|
|
|
|
// unique: true,
|
|
|
|
nonNullable: true,
|
|
|
|
unsigned: true,
|
|
|
|
defaultTo: 12.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
articles: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'oneToMany',
|
|
|
|
target: 'article',
|
|
|
|
mappedBy: 'category',
|
|
|
|
},
|
2021-06-28 21:37:44 +02:00
|
|
|
compo: {
|
|
|
|
type: 'component',
|
2021-07-21 18:14:16 +02:00
|
|
|
component: 'compo-test',
|
2021-06-28 21:37:44 +02:00
|
|
|
},
|
2021-06-24 18:28:36 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const article = {
|
|
|
|
modelName: 'article',
|
|
|
|
uid: 'article',
|
|
|
|
collectionName: 'articles',
|
|
|
|
attributes: {
|
|
|
|
title: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2021-07-07 18:04:39 +02:00
|
|
|
category: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'manyToOne',
|
|
|
|
target: 'category',
|
|
|
|
inversedBy: 'articles',
|
|
|
|
// useJoinTable: false,
|
|
|
|
},
|
2021-07-06 14:18:03 +02:00
|
|
|
// tags: {
|
|
|
|
// type: 'relation',
|
|
|
|
// relation: 'manyToMany',
|
|
|
|
// target: 'tag',
|
|
|
|
// inversedBy: 'articles',
|
|
|
|
// },
|
2021-07-07 18:04:39 +02:00
|
|
|
// compo: {
|
|
|
|
// type: 'component',
|
2021-07-21 18:14:16 +02:00
|
|
|
// component: 'compo-test',
|
2021-07-07 18:04:39 +02:00
|
|
|
// // repeatable: true,
|
|
|
|
// },
|
2021-06-24 18:28:36 +02:00
|
|
|
// cover: {
|
|
|
|
// type: 'media',
|
|
|
|
// single: true,
|
|
|
|
// },
|
|
|
|
// gallery: {
|
|
|
|
// type: 'media',
|
|
|
|
// multiple: true,
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const tags = {
|
|
|
|
modelName: 'tag',
|
|
|
|
uid: 'tag',
|
|
|
|
collectionName: 'tags',
|
|
|
|
attributes: {
|
|
|
|
name: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
articles: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'manyToMany',
|
|
|
|
target: 'article',
|
|
|
|
mappedBy: 'tag',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const compo = {
|
2021-07-21 18:14:16 +02:00
|
|
|
modelName: 'compoTest',
|
|
|
|
uid: 'compo-test',
|
|
|
|
collectionName: 'compo_tests',
|
2021-06-24 18:28:36 +02:00
|
|
|
attributes: {
|
|
|
|
key: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
value: {
|
2021-06-25 12:07:32 +02:00
|
|
|
type: 'string',
|
2021-06-24 18:28:36 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const user = {
|
|
|
|
modelName: 'user',
|
|
|
|
uid: 'user',
|
|
|
|
collectionName: 'users',
|
|
|
|
attributes: {
|
|
|
|
address: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'oneToOne',
|
|
|
|
target: 'address',
|
|
|
|
inversedBy: 'user',
|
|
|
|
// useJoinTable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const address = {
|
|
|
|
modelName: 'address',
|
|
|
|
uid: 'address',
|
|
|
|
collectionName: 'addresses',
|
|
|
|
attributes: {
|
|
|
|
name: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'oneToOne',
|
|
|
|
target: 'user',
|
|
|
|
mappedBy: 'address',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const file = {
|
|
|
|
modelName: 'file',
|
|
|
|
uid: 'file',
|
|
|
|
collectionName: 'files',
|
|
|
|
attributes: {
|
|
|
|
name: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
alternativeText: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
caption: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
width: {
|
|
|
|
type: 'integer',
|
|
|
|
},
|
|
|
|
height: {
|
|
|
|
type: 'integer',
|
|
|
|
},
|
|
|
|
formats: {
|
|
|
|
type: 'json',
|
|
|
|
},
|
|
|
|
hash: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
ext: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
mime: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
type: 'decimal',
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
previewUrl: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
provider: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
provider_metadata: {
|
|
|
|
type: 'json',
|
|
|
|
},
|
|
|
|
// related: {
|
|
|
|
// type: 'relation',
|
|
|
|
// relation: 'oneToMany',
|
|
|
|
// target: 'file_morph',
|
|
|
|
// mappedBy: 'file',
|
|
|
|
// },
|
|
|
|
// related: {
|
|
|
|
// type: 'relation',
|
|
|
|
// realtion: 'morphTo',
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const fileMorph = {
|
|
|
|
modelName: 'file-morph',
|
|
|
|
uid: 'file-morph',
|
|
|
|
collectionName: 'file_morphs',
|
|
|
|
attributes: {
|
|
|
|
// file: {
|
|
|
|
// type: 'relation',
|
|
|
|
// relation: 'manyToOne',
|
|
|
|
// target: 'file',
|
|
|
|
// inversedBy: 'related',
|
|
|
|
// useJoinTable: false,
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-06-28 21:37:44 +02:00
|
|
|
const blogPost = {
|
|
|
|
modelName: 'blogPost',
|
|
|
|
uid: 'blogPost',
|
|
|
|
collectionName: 'blog_posts',
|
|
|
|
attributes: {
|
|
|
|
passwordField: {
|
|
|
|
type: 'password',
|
|
|
|
},
|
|
|
|
emailField: {
|
|
|
|
type: 'email',
|
|
|
|
},
|
|
|
|
stringField: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
uidField: {
|
|
|
|
type: 'uid',
|
|
|
|
},
|
|
|
|
richtextField: {
|
|
|
|
type: 'richtext',
|
|
|
|
},
|
|
|
|
textField: {
|
|
|
|
type: 'text',
|
|
|
|
},
|
|
|
|
enumerationField: {
|
|
|
|
type: 'enumeration',
|
|
|
|
enum: ['A', 'B'],
|
|
|
|
},
|
|
|
|
jsonField: {
|
|
|
|
type: 'json',
|
|
|
|
},
|
|
|
|
bigintegerField: {
|
|
|
|
type: 'biginteger',
|
|
|
|
},
|
|
|
|
integerField: {
|
|
|
|
type: 'integer',
|
|
|
|
},
|
|
|
|
floatField: {
|
|
|
|
type: 'float',
|
|
|
|
},
|
|
|
|
decimalField: {
|
|
|
|
type: 'decimal',
|
|
|
|
},
|
|
|
|
dateField: {
|
|
|
|
type: 'date',
|
|
|
|
},
|
|
|
|
timeField: {
|
|
|
|
type: 'time',
|
|
|
|
},
|
|
|
|
datetimeField: {
|
|
|
|
type: 'datetime',
|
|
|
|
},
|
|
|
|
timestampField: {
|
|
|
|
type: 'timestamp',
|
|
|
|
},
|
|
|
|
booleanField: {
|
|
|
|
type: 'boolean',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-07-21 18:14:16 +02:00
|
|
|
// module.exports = [category, article, tags, compo, user, address, file, fileMorph, blogPost];
|
|
|
|
|
|
|
|
const file = {
|
|
|
|
uid: 'file',
|
|
|
|
modelName: 'file',
|
|
|
|
collectionName: 'files',
|
|
|
|
attributes: {
|
|
|
|
related: {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const post = {
|
|
|
|
uid: 'post',
|
|
|
|
modelName: 'post',
|
|
|
|
collectionName: 'posts',
|
|
|
|
attributes: {
|
|
|
|
cover: {
|
|
|
|
type: 'relation',
|
|
|
|
relation: 'manyToOne',
|
|
|
|
target: 'file'
|
|
|
|
// inversedBy: 'related'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = [file, post];
|