-
Notifications
You must be signed in to change notification settings - Fork 4
コレクション&フィールド設計
Kazane Shimizu edited this page Mar 1, 2023
·
1 revision
- 名称の定義
- 入力されたデータは
コンテンツ(content)
- コンテンツを入れる箱を
コレクション(collection)
- 入力されたデータは
directusを参考にしています
カラム名 | タイプ | 長さ | NULL許可 | キー | デフォルト | コメント |
---|---|---|---|---|---|---|
collection | varchar | 64 | primary | テーブル名 | ||
singleton | boolean | 1 | false | true:単票モデル、false:リストモデル | ||
hidden | boolean | 1 | 関連テーブルなど画面に表示しない場合 | |||
created_at | dateTime | |||||
updated_at | dateTime |
カラム名 | タイプ | 長さ | NULL許可 | キー | デフォルト | コメント |
---|---|---|---|---|---|---|
id | int | 11 | primary | |||
collection | varchar | 64 | primary | テーブル名 | ||
field | varchar | 64 | フィールド名 (例: name) | |||
label | varchar | 64 | フィールドの表示名 (例: 名前) | |||
special | varchar | 64 | Yes | one 2 manyとかの関連を入れてる | ||
interface | varchar | 64 | Yes | input, input-multiline, input-rich-text-md ... etc | ||
readonly | boolean | 1 | 修正不可(idとか) | |||
required | boolean | 1 | 値入力が必須かどうか | |||
hidden | boolean | 1 | 表示しない | |||
options | json | Yes | 最小/最大桁数制限とか、画面で使うオプションをkey-valueで入れる | |||
sort | integer | 8 | Yes | カラムの表示順 | ||
created_at | dateTime | |||||
updated_at | dateTime |
カラム名 | タイプ | 長さ | NULL許可 | キー | デフォルト | コメント |
---|---|---|---|---|---|---|
id | int | 11 | primary | |||
many_collection | varchar | 64 | ||||
many_field | varchar | 64 | ||||
one_collection | varchar | 64 | ||||
one_field | varchar | 64 | Yes | |||
one_collection_field | varchar | 64 | Yes | |||
one_allowed_collections | text | Yes | ||||
junction_field | varchar | 64 | Yes | |||
sort_field | varchar | 64 | Yes | |||
one_deselect_action | varchar | 255 | Yes | |||
created_at | dateTime | |||||
updated_at | dateTime |
directusからまんまもってきた。関連性を表すメタ情報
/collections
例)http://localhost:8080/collections
collections: [
{
collection: 'Restaurant'
singleton: false,
fields: [
{
collection: Restaurant,
field: 'name',
interface: 'input',
...
},
{
collection: Restaurant,
field: 'nick name
interface: 'input',
...
},
]
},
{
collection: 'Company'
singleton: true,
fields: [
{
collection: Company,
field: 'name',
interface: 'input',
...
},
{
collection: Company,
field: 'company name
interface: 'input',
...
},
]
}
]
POST /collections
{
collection: "Restaurant",
singleton: false,
hidden: false
}
collection: {
collection: 'Restaurant'
singleton: false
}
superfast_collections
id | collection | singleton | hidden |
---|---|---|---|
1 | Restaurant | false | false |
superfast_fields(一部省略)
id | collection | field | label | interface |
---|---|---|---|---|
1 | Restaurant | id | Id | input |
Restaurant
カラム名 | タイプ | 長さ | NULL許可 | キー | デフォルト | コメント |
---|---|---|---|---|---|---|
id | int | 11 | primary | |||
status | varchar | 20 | draft | 'draft' or 'published' | ||
published_at | dateTime | |||||
created_at | dateTime | |||||
updated_at | dateTime |
PUT /collections/:collection
例)http://localhost:8080/collections/Restaurant
collection, singletonは変更不可
{
hidden: false,
}
collection: {
collection: 'Restaurant'
singleton: false,
hidden: false
}
DELETE /collections/:collection
例)http://localhost:8080/collections/Restaurant
以下を削除
- superfast_collections
- superfast_fields
- Restaurantテーブル
POST /fields/:collection
例)http://localhost:8080/fields/Restaurant
{
field: has_parking,
label: '駐車場有無',
interface: 'select-dropdown',
readonly: false,
required: true,
hidden: false
}
field: {
collection: Restaurant,
field: has_parking,
label: '駐車場有無',
interface: 'select-dropdown',
readonly: false,
required: true,
hidden: false
}
Restaurant
カラム名 | タイプ | 長さ | NULL許可 | キー | デフォルト | コメント |
---|---|---|---|---|---|---|
id | int | 11 | primary | |||
has_parking | varhcar | 255 | ||||
created_at | dateTime | |||||
updated_at | dateTime |
DELETE /fields/:id
例)http://localhost:8080/fieldes/1
以下を削除
- superfast_fieldsの該当行
- Restaurantテーブルの該当カラム