Various system schema name changes

Fixes #482
This commit is contained in:
rijkvanzanten
2020-10-02 17:43:58 -04:00
parent 29c18075d4
commit bf76244ba7
82 changed files with 213 additions and 213 deletions

View File

@@ -52,7 +52,7 @@ router.post(
const primaryKey = await service.create({
...req.body,
action: Action.COMMENT,
action_by: req.accountability?.user,
user: req.accountability?.user,
ip: req.ip,
user_agent: req.get('user-agent'),
});

View File

@@ -21,7 +21,7 @@ columns:
type: boolean
nullable: false
default: false
translation:
translations:
type: json
archive_field:
type: string

View File

@@ -52,7 +52,7 @@ columns:
references:
table: directus_fields
column: id
translation:
translations:
type: json
note:
type: text

View File

@@ -7,9 +7,9 @@ columns:
type: string
length: 45
nullable: false
action_by:
user:
type: uuid
action_on:
timestamp:
type: timestamp
nullable: false
default: '$now'

View File

@@ -9,7 +9,7 @@ columns:
type: string
length: 255
nullable: false
parent_folder:
parent:
type: uuid
references:
table: directus_folders

View File

@@ -6,7 +6,7 @@ defaults:
singleton: false
icon: null
note: null
translation: null
translations: null
display_template: null
data:

View File

@@ -38,19 +38,19 @@ data:
layout: tabular
layout_query:
tabular:
sort: -action_on
sort: -timestamp
fields:
- action
- collection
- action_on
- action_by
- timestamp
- user
layout_options:
tabular:
widths:
action: 100
collection: 210
action_on: 240
action_by: 240
timestamp: 240
user: 240
- collection: directus_webhooks
layout: tabular

View File

@@ -33,7 +33,7 @@ data:
one_collection: directus_users
one_primary: id
- many_collection: directus_folders
many_field: parent_folder
many_field: parent
many_primary: id
one_collection: directus_folders
one_primary: id
@@ -54,7 +54,7 @@ data:
one_field: fields
one_primary: id
- many_collection: directus_activity
many_field: action_by
many_field: user
many_primary: id
one_collection: directus_users
one_primary: id

View File

@@ -63,7 +63,7 @@ fields:
sort: 7
width: half
- collection: directus_collections
field: translation
field: translations
special: json
interface: repeater
options:
@@ -78,7 +78,7 @@ fields:
interface: system-language
width: half
- field: translation
name: Translation
name: translation
type: string
meta:
interface: text-input

View File

@@ -33,7 +33,7 @@ fields:
locked: true
special: csv
- collection: directus_fields
field: translation
field: translations
hidden: true
locked: true
special: json

View File

@@ -9,9 +9,9 @@ fields:
iconRight: title
placeholder: My project...
sort: 1
translation:
translations:
locale: en-US
translation: Name
translations: Name
width: half
- collection: directus_settings
field: project_url
@@ -21,9 +21,9 @@ fields:
iconRight: link
placeholder: https://example.com
sort: 2
translation:
translations:
locale: en-US
translation: Website
translations: Website
width: half
- collection: directus_settings
field: project_color
@@ -31,9 +31,9 @@ fields:
locked: true
note: Login & Logo Background
sort: 3
translation:
translations:
locale: en-US
translation: Brand Color
translations: Brand Color
width: half
- collection: directus_settings
field: project_logo
@@ -41,9 +41,9 @@ fields:
locked: true
note: White 40x40 SVG/PNG
sort: 4
translation:
translations:
locale: en-US
translation: Brand Logo
translations: Brand Logo
width: half
- collection: directus_settings
field: public_divider
@@ -61,18 +61,18 @@ fields:
interface: file
locked: true
sort: 6
translation:
translations:
locale: en-US
translation: Login Foreground
translations: Login Foreground
width: half
- collection: directus_settings
field: public_background
interface: file
locked: true
sort: 7
translation:
translations:
locale: en-US
translation: Login Background
translations: Login Background
width: half
- collection: directus_settings
field: public_note

View File

@@ -30,12 +30,12 @@ fields:
display_options:
icon: true
- collection: directus_activity
field: action_on
field: timestamp
display: datetime
options:
relative: true
- collection: directus_activity
field: action_by
field: user
display: user
- collection: directus_activity
field: comment

View File

@@ -11,5 +11,5 @@ hidden: false
sort: null
width: full
group: null
translation: null
translations: null
note: null

View File

@@ -47,7 +47,7 @@ type FieldSeed = {
sort: number | null;
width: string | null;
group: number | null;
translation: Record<string, any> | null;
translations: Record<string, any> | null;
note: string | null;
}[];
};

View File

@@ -93,7 +93,7 @@ export class AuthenticationService {
if (this.accountability) {
await this.activityService.create({
action: Action.AUTHENTICATE,
action_by: user.id,
user: user.id,
ip: this.accountability.ip,
user_agent: this.accountability.userAgent,
collection: 'directus_users',

View File

@@ -133,7 +133,7 @@ export class ItemsService implements AbstractService {
if (this.accountability) {
const activityRecords = primaryKeys.map((key) => ({
action: Action.CREATE,
action_by: this.accountability!.user,
user: this.accountability!.user,
collection: this.collection,
ip: this.accountability!.ip,
user_agent: this.accountability!.userAgent,
@@ -335,7 +335,7 @@ export class ItemsService implements AbstractService {
if (this.accountability) {
const activityRecords = keys.map((key) => ({
action: Action.UPDATE,
action_by: this.accountability!.user,
user: this.accountability!.user,
collection: this.collection,
ip: this.accountability!.ip,
user_agent: this.accountability!.userAgent,
@@ -451,7 +451,7 @@ export class ItemsService implements AbstractService {
if (this.accountability) {
const activityRecords = keys.map((key) => ({
action: Action.DELETE,
action_by: this.accountability!.user,
user: this.accountability!.user,
collection: this.collection,
ip: this.accountability!.ip,
user_agent: this.accountability!.userAgent,

View File

@@ -10,7 +10,7 @@ export type Collection = {
hidden: boolean;
singleton: boolean;
icon: string | null;
translation: Record<string, string>;
translations: Record<string, string>;
} | null;
schema: Table;
};

View File

@@ -34,7 +34,7 @@ export type FieldMeta = {
width: string | null;
group: number | null;
note: string | null;
translation: null;
translations: null;
};
export type Field = {

View File

@@ -5648,9 +5648,9 @@
"group": null,
"length": "45"
},
"action_by": {
"user": {
"collection": "directus_activity",
"field": "action_by",
"field": "user",
"datatype": "INT",
"unique": false,
"primary_key": false,
@@ -5679,9 +5679,9 @@
"group": null,
"length": "10"
},
"action_on": {
"timestamp": {
"collection": "directus_activity",
"field": "action_on",
"field": "timestamp",
"datatype": "DATETIME",
"unique": false,
"primary_key": false,
@@ -7832,9 +7832,9 @@
"group": null,
"length": "191"
},
"parent_folder": {
"parent": {
"collection": "directus_folders",
"field": "parent_folder",
"field": "parent",
"datatype": "INT",
"unique": false,
"primary_key": false,

View File

@@ -1313,7 +1313,7 @@
},
{
"collection": "directus_activity",
"field": "action_by",
"field": "user",
"datatype": "INT",
"unique": false,
"primary_key": false,
@@ -1345,7 +1345,7 @@
},
{
"collection": "directus_activity",
"field": "action_on",
"field": "timestamp",
"datatype": "DATETIME",
"unique": false,
"primary_key": false,
@@ -3509,7 +3509,7 @@
},
{
"collection": "directus_folders",
"field": "parent_folder",
"field": "parent",
"datatype": "INT",
"unique": false,
"primary_key": false,

View File

@@ -123,7 +123,7 @@
{
"id": 53,
"collection_many": "directus_activity",
"field_many": "action_by",
"field_many": "user",
"collection_one": "directus_users",
"field_one": null,
"junction_field": null
@@ -155,7 +155,7 @@
{
"id": 59,
"collection_many": "directus_folders",
"field_many": "parent_folder",
"field_many": "parent",
"collection_one": "directus_folders",
"field_one": null,
"junction_field": null

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Akce",
"collection": "Kategorie",
"item": "Primární klíč položky",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP adresa",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Aktion",
"collection": "Sammlung",
"item": "Item-Primärschlüssel",
"action_by": "Aktion von",
"action_on": "Aktion am",
"user": "Aktion von",
"timestamp": "Aktion am",
"edited_on": "Bearbeitet am",
"comment_deleted_on": "Kommentar gelöscht am",
"ip": "IP Adresse",

View File

@@ -59,8 +59,8 @@
"action": "Ενέργεια",
"collection": "Συλλογή",
"item": "Στοιχείο Πρωτεύον Κλειδί",
"action_by": "Ενέργεια από",
"action_on": "Ενέργεια στις",
"user": "Ενέργεια από",
"timestamp": "Ενέργεια στις",
"edited_on": "Επεξεργασμένο στις",
"comment_deleted_on": "Το σχόλιο διεγράφη στις",
"ip": "Διεύθυνση IP",

View File

@@ -982,8 +982,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Acción",
"collection": "Colección",
"item": "Clave Primaria del Item",
"action_by": "Realizado por",
"action_on": "Realizado en",
"user": "Realizado por",
"timestamp": "Realizado en",
"edited_on": "Editado el",
"comment_deleted_on": "Comentario eliminado el",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Acción",
"collection": "Colección",
"item": "Clave Primaria del Item",
"action_by": "Realizado por",
"action_on": "Realizado en",
"user": "Realizado por",
"timestamp": "Realizado en",
"edited_on": "Editado el",
"comment_deleted_on": "Comentario eliminado el",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Acción",
"collection": "Colección",
"item": "Clave Primaria del Item",
"action_by": "Realizado por",
"action_on": "Realizado en",
"user": "Realizado por",
"timestamp": "Realizado en",
"edited_on": "Editado el",
"comment_deleted_on": "Comentario eliminado el",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Clé principale de l'élément",
"action_by": "Action par",
"action_on": "Action quand",
"user": "Action par",
"timestamp": "Action quand",
"edited_on": "Modifié le",
"comment_deleted_on": "Commentaire supprimé le",
"ip": "Adresse IP",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Azioni",
"collection": "Collezione",
"item": "Chiave primaria elemento",
"action_by": "Azione di",
"action_on": "Azione il",
"user": "Azione di",
"timestamp": "Azione il",
"edited_on": "Modificato il",
"comment_deleted_on": "Commento eliminato il",
"ip": "Indirizzo IP",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Veiksmas",
"collection": "Rinkinys",
"item": "Įrašo Pirminis Raktas",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -61,8 +61,8 @@
"action": "Actie",
"collection": "Collectie",
"item": "Item Primary Key",
"action_by": "Actie door",
"action_on": "Actie op",
"user": "Actie door",
"timestamp": "Actie op",
"edited_on": "Aangepast op",
"comment_deleted_on": "Reactie verwijderd op",
"ip": "IP Adres",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Czynność",
"collection": "Kolekcja",
"item": "Klucz główny produktu",
"action_by": "Czynność przez",
"action_on": "Czynność na",
"user": "Czynność przez",
"timestamp": "Czynność na",
"edited_on": "Edytowano",
"comment_deleted_on": "Komentarz usunięty",
"ip": "Adres IP",

View File

@@ -59,8 +59,8 @@
"action": "Ação",
"collection": "Coleção",
"item": "Chave Primária do Item",
"action_by": "Ação Por",
"action_on": "Ação Em",
"user": "Ação Por",
"timestamp": "Ação Em",
"edited_on": "Editado Em",
"comment_deleted_on": "Comentário Excluído Em",
"ip": "Endereço de IP",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Acţiune",
"collection": "Colecție",
"item": "Cheia primară a elementului",
"action_by": "Acțiune de",
"action_on": "Acțiune pe",
"user": "Acțiune de",
"timestamp": "Acțiune pe",
"edited_on": "Modificat la data de",
"comment_deleted_on": "Comentariu șters la data de",
"ip": "Adresă IP",

View File

@@ -59,8 +59,8 @@
"action": "Действие",
"collection": "Коллекция",
"item": "Ключ предмета",
"action_by": "Действовал",
"action_on": "Действие на",
"user": "Действовал",
"timestamp": "Действие на",
"edited_on": "Изменено",
"comment_deleted_on": "Комментарий удалён",
"ip": "IP-адрес",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP-adress",

View File

@@ -59,8 +59,8 @@
"action": "İşlem",
"collection": "Koleksiyon",
"item": "Öğe Birincil Anahtarı",
"action_by": "Uygulayan",
"action_on": "Tarihinde Uygulandı",
"user": "Uygulayan",
"timestamp": "Tarihinde Uygulandı",
"edited_on": "Tarihinde Düzenlendi",
"comment_deleted_on": "Tarihinde Yorum Silindi",
"ip": "IP Adresi",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Колекція",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Змінено",
"comment_deleted_on": "Коментар видалено",
"ip": "IP адреса",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -59,8 +59,8 @@
"action": "操作",
"collection": "集合",
"item": "项目主键",
"action_by": "操作人",
"action_on": "操作于",
"user": "操作人",
"timestamp": "操作于",
"edited_on": "编辑于",
"comment_deleted_on": "评论删除于",
"ip": "IP 地址",

View File

@@ -59,8 +59,8 @@
"action": "Action",
"collection": "Collection",
"item": "Item Primary Key",
"action_by": "Action By",
"action_on": "Action On",
"user": "Action By",
"timestamp": "Action On",
"edited_on": "Edited On",
"comment_deleted_on": "Comment Deleted On",
"ip": "IP Address",

View File

@@ -9,7 +9,7 @@
</v-list-item-content>
</v-list-item>
<v-list-item :to="`/activity?action_by=${currentUserID}`" exact>
<v-list-item :to="`/activity?user=${currentUserID}`" exact>
<v-list-item-icon>
<v-icon name="face" />
</v-list-item-icon>

View File

@@ -11,15 +11,15 @@
<template v-else>
<!-- @TODO add final design -->
<p class="type-label">User:</p>
<user-popover v-if="item.action_by" :user="item.action_by.id">
{{ item.action_by.first_name }} {{ item.action_by.last_name }}
<user-popover v-if="item.user" :user="item.user.id">
{{ item.user.first_name }} {{ item.user.last_name }}
</user-popover>
<p class="type-label">Action:</p>
<p>{{ item.action }}</p>
<p class="type-label">Date:</p>
<p>{{ item.action_on }}</p>
<p>{{ item.timestamp }}</p>
<p class="type-label">IP Address:</p>
<p>{{ item.ip }}</p>
@@ -56,12 +56,12 @@ type Values = {
};
type ActivityRecord = {
action_by: {
user: {
first_name: string;
last_name: string;
} | null;
action: string;
action_on: string;
timestamp: string;
ip: string;
user_agent: string;
collection: string;
@@ -105,11 +105,11 @@ export default defineComponent({
const response = await api.get(`/activity/${props.primaryKey}`, {
params: {
fields: [
'action_by.id',
'action_by.first_name',
'action_by.last_name',
'user.id',
'user.first_name',
'user.last_name',
'action',
'action_on',
'timestamp',
'ip',
'user_agent',
'collection',

View File

@@ -50,7 +50,7 @@ export default defineComponent({
try {
const newFolder = await api.post(`/folders`, {
name: newFolderName.value,
parent_folder: props.parent === 'root' ? null : props.parent,
parent: props.parent === 'root' ? null : props.parent,
});
await fetchFolders();

View File

@@ -40,7 +40,7 @@ import FolderPickerListItem from './folder-picker-list-item.vue';
type FolderRaw = {
id: string;
name: string;
parent_folder: null | string;
parent: null | string;
};
type Folder = {
@@ -67,7 +67,7 @@ export default defineComponent({
const error = ref<any>(null);
const tree = computed<Folder[]>(() => {
return folders.value
.filter((folder) => folder.parent_folder === null)
.filter((folder) => folder.parent === null)
.map((folder) => {
return {
...folder,
@@ -78,7 +78,7 @@ export default defineComponent({
function getChildFolders(folder: FolderRaw): Folder[] {
return folders.value
.filter((childFolder) => {
return childFolder.parent_folder === folder.id;
return childFolder.parent === folder.id;
})
.map((childFolder) => {
return {
@@ -92,7 +92,7 @@ export default defineComponent({
const shouldBeOpen: string[] = [];
const folder = folders.value.find((folder) => folder.id === props.value);
if (folder && folder.parent_folder) parseFolder(folder.parent_folder);
if (folder && folder.parent) parseFolder(folder.parent);
const startOpenFolders = ['root'];
@@ -137,8 +137,8 @@ export default defineComponent({
const folder = folders.value.find((folder) => folder.id === id);
if (folder && folder.parent_folder) {
parseFolder(folder.parent_folder);
if (folder && folder.parent) {
parseFolder(folder.parent);
}
}
},

View File

@@ -181,7 +181,7 @@ export default defineComponent({
function useMoveFolder() {
const moveActive = ref(false);
const moveValue = ref(props.folder.parent_folder);
const moveValue = ref(props.folder.parent);
const moveSaving = ref(false);
return { moveActive, moveValue, moveSave, moveSaving };
@@ -191,7 +191,7 @@ export default defineComponent({
try {
await api.patch(`/folders/${props.folder.id}`, {
parent_folder: moveValue.value,
parent: moveValue.value,
});
} catch (error) {
console.error(error);
@@ -216,7 +216,7 @@ export default defineComponent({
const foldersToUpdate = await api.get('/folders', {
params: {
filter: {
parent_folder: {
parent: {
_eq: props.folder.id,
},
},
@@ -233,13 +233,13 @@ export default defineComponent({
},
});
const newParent = props.folder.parent_folder || null;
const newParent = props.folder.parent || null;
const folderKeys = foldersToUpdate.data.data.map((folder: { id: string }) => folder.id);
const fileKeys = filesToUpdate.data.data.map((file: { id: string }) => file.id);
if (folderKeys.length > 0) {
await api.patch(`/folders/${folderKeys.join(',')}`, { parent_folder: newParent });
await api.patch(`/folders/${folderKeys.join(',')}`, { parent: newParent });
}
if (fileKeys.length > 0) {

View File

@@ -79,7 +79,7 @@ export default defineComponent({
const shouldBeOpen: string[] = [];
const folder = folders.value.find((folder) => folder.id === props.currentFolder);
if (folder && folder.parent_folder) parseFolder(folder.parent_folder);
if (folder && folder.parent) parseFolder(folder.parent);
const newOpenFolders = [...openFolders.value];
@@ -99,8 +99,8 @@ export default defineComponent({
const folder = folders.value.find((folder) => folder.id === id);
if (folder && folder.parent_folder) {
parseFolder(folder.parent_folder);
if (folder && folder.parent) {
parseFolder(folder.parent);
}
}
}

View File

@@ -6,13 +6,13 @@ import { TranslateResult } from 'vue-i18n';
type FolderRaw = {
id: string;
name: string;
parent_folder: string | null;
parent: string | null;
};
export type Folder = {
id: string | null;
name: string | TranslateResult;
parent_folder: string | null;
parent: string | null;
children?: Folder[];
};
@@ -65,14 +65,14 @@ export default function useFolders() {
export function nestFolders(rawFolders: FolderRaw[]) {
return rawFolders
.map((rawFolder) => nestChildren(rawFolder, rawFolders))
.filter((folder) => folder.parent_folder === null);
.filter((folder) => folder.parent === null);
}
export function nestChildren(rawFolder: FolderRaw, rawFolders: FolderRaw[]) {
const folder: FolderRaw & Folder = { ...rawFolder };
const children = rawFolders
.filter((childFolder) => childFolder.parent_folder === rawFolder.id && childFolder.id !== rawFolder.id)
.filter((childFolder) => childFolder.parent === rawFolder.id && childFolder.id !== rawFolder.id)
.map((childRawFolder) => nestChildren(childRawFolder, rawFolders));
if (children.length > 0) {

View File

@@ -125,9 +125,9 @@
</div>
<div class="field full">
<div class="label type-label">{{ $t('translation') }}</div>
<div class="label type-label">{{ $t('translations') }}</div>
<interface-repeater
v-model="fieldData.meta.translation"
v-model="fieldData.meta.translations"
:template="'{{ translation }} ({{ locale }})'"
:fields="[
{

View File

@@ -32,7 +32,7 @@ export default defineComponent({
try {
const response = await api.get('/auth/oauth/');
providers.value = response.data.data.map((providerName: string) => {
providers.value = response.data.data?.map((providerName: string) => {
return {
name: providerName,
link: `${getRootPath()}auth/oauth/${providerName.toLowerCase()}?redirect=${

View File

@@ -29,9 +29,9 @@ export const useCollectionsStore = createStore({
let name: string | VueI18n.TranslateResult;
const icon = collection.meta?.icon || 'label';
if (collection.meta && notEmpty(collection.meta.translation)) {
for (let i = 0; i < collection.meta.translation.length; i++) {
const { locale, translation } = collection.meta.translation[i];
if (collection.meta && notEmpty(collection.meta.translations)) {
for (let i = 0; i < collection.meta.translations.length; i++) {
const { locale, translation } = collection.meta.translations[i];
i18n.mergeLocaleMessage(locale, {
collection_names: {

View File

@@ -28,7 +28,7 @@ const fakeFilesField: Field = {
hidden: false,
locked: true,
required: false,
translation: null,
translations: null,
readonly: true,
width: 'full',
group: null,
@@ -76,9 +76,9 @@ export const useFieldsStore = createStore({
if (i18n.te(`fields.${field.collection}.${field.field}`)) {
name = i18n.t(`fields.${field.collection}.${field.field}`);
} else if (field.meta && notEmpty(field.meta.translation) && field.meta.translation.length > 0) {
for (let i = 0; i < field.meta.translation.length; i++) {
const { locale, translation } = field.meta.translation[i];
} else if (field.meta && notEmpty(field.meta.translations) && field.meta.translations.length > 0) {
for (let i = 0; i < field.meta.translations.length; i++) {
const { locale, translation } = field.meta.translations[i];
i18n.mergeLocaleMessage(locale, {
fields: {

View File

@@ -1,6 +1,6 @@
import VueI18n from 'vue-i18n';
type Translation = {
type Translations = {
locale: string;
translation: string;
};
@@ -12,7 +12,7 @@ export interface CollectionRaw {
hidden: boolean;
singleton: boolean;
icon: string | null;
translation: Translation[] | null;
translations: Translations[] | null;
display_template: string | null;
sort_field: string | null;
archive_field: string | null;

View File

@@ -1,6 +1,6 @@
import { TranslateResult } from 'vue-i18n';
type Translation = {
type Translations = {
locale: string;
translation: string;
};
@@ -61,7 +61,7 @@ export type FieldMeta = {
required: boolean;
sort: number | null;
special: string[] | null;
translation: null | Translation[];
translations: null | Translations[];
width: Width | null;
note: string | TranslateResult | null;
};

View File

@@ -4,16 +4,16 @@
<img
v-if="avatarSource"
:src="avatarSource"
:alt="activity.action_by.first_name + ' ' + activity.action_by.last_name"
:alt="activity.user.first_name + ' ' + activity.user.last_name"
/>
<v-icon v-else name="person_outline" />
</v-avatar>
<div class="name">
<user-popover v-if="activity.action_by && activity.action_by.id" :user="activity.action_by.id">
<user-popover v-if="activity.user && activity.user.id" :user="activity.user.id">
<span>
<template v-if="activity.action_by && activity.action_by">
{{ activity.action_by.first_name }} {{ activity.action_by.last_name }}
<template v-if="activity.user && activity.user">
{{ activity.user.first_name }} {{ activity.user.last_name }}
</template>
<template v-else>
@@ -101,18 +101,18 @@ export default defineComponent({
);
const formattedTime = computed(() => {
if (props.activity.action_on) {
// action_on is in iso-8601
return format(new Date(props.activity.action_on), String(i18n.t('date-fns_time')));
if (props.activity.timestamp) {
// timestamp is in iso-8601
return format(new Date(props.activity.timestamp), String(i18n.t('date-fns_time')));
}
return null;
});
const avatarSource = computed(() => {
if (!props.activity.action_by?.avatar) return null;
if (!props.activity.user?.avatar) return null;
return getRootPath() + `assets/${props.activity.action_by.avatar.id}?key=system-small-cover`;
return getRootPath() + `assets/${props.activity.user.avatar.id}?key=system-small-cover`;
});
const { confirmDelete, deleting, remove } = useDelete();

View File

@@ -79,11 +79,11 @@ export default defineComponent({
fields: [
'id',
'action',
'action_on',
'action_by.id',
'action_by.first_name',
'action_by.last_name',
'action_by.avatar.id',
'timestamp',
'user.id',
'user.first_name',
'user.last_name',
'user.avatar.id',
'revisions.id',
'comment',
],
@@ -93,8 +93,8 @@ export default defineComponent({
count.value = response.data.data.length;
const activityByDate = groupBy(response.data.data, (activity: Activity) => {
// activity's action_on date is in iso-8601
const date = new Date(new Date(activity.action_on).toDateString());
// activity's timestamp date is in iso-8601
const date = new Date(new Date(activity.timestamp).toDateString());
return date;
});

View File

@@ -3,13 +3,13 @@ import { Avatar } from '@/types';
export type Activity = {
id: number;
action: 'comment';
action_by: null | {
user: null | {
id: number;
first_name: string;
last_name: string;
avatar: null | Avatar;
};
action_on: string;
timestamp: string;
edited_on: null | string;
comment: null | string;
};

View File

@@ -7,8 +7,8 @@
<div class="content">
<span class="time">{{ time }}</span>
<user-popover v-if="revision.activity.action_by" class="user" :user="revision.activity.action_by.id">
<router-link :to="`/users/${revision.activity.action_by.id}`">{{ user }}</router-link>
<user-popover v-if="revision.activity.user" class="user" :user="revision.activity.user.id">
<router-link :to="`/users/${revision.activity.user.id}`">{{ user }}</router-link>
</user-popover>
<span v-else>{{ $t('private_user') }}</span>
@@ -56,12 +56,12 @@ export default defineComponent({
});
const time = computed(() => {
return format(new Date(props.revision.activity.action_on), String(i18n.t('date-fns_time')));
return format(new Date(props.revision.activity.timestamp), String(i18n.t('date-fns_time')));
});
const user = computed(() => {
if (props.revision?.activity?.action_by && typeof props.revision.activity.action_by === 'object') {
const { first_name, last_name } = props.revision.activity.action_by as {
if (props.revision?.activity?.user && typeof props.revision.activity.user === 'object') {
const { first_name, last_name } = props.revision.activity.user as {
first_name: string;
last_name: string;
};

View File

@@ -129,10 +129,10 @@ export default defineComponent({
'collection',
'item',
'activity.action',
'activity.action_on',
'activity.action_by.id',
'activity.action_by.first_name',
'activity.action_by.last_name',
'activity.timestamp',
'activity.user.id',
'activity.user.first_name',
'activity.user.last_name',
'activity.ip',
'activity.user_agent',
],
@@ -140,8 +140,8 @@ export default defineComponent({
});
const revisionsGroupedByDate = groupBy(response.data.data, (revision: Revision) => {
// revision's action_on date is in iso-8601
const date = new Date(new Date(revision.activity.action_on).toDateString());
// revision's timestamp date is in iso-8601
const date = new Date(new Date(revision.activity.timestamp).toDateString());
return date;
});
@@ -164,12 +164,12 @@ export default defineComponent({
revisionsGrouped.push({
date: date,
dateFormatted: String(dateFormatted),
revisions: orderBy(value, ['activity.action_on'], ['desc']),
revisions: orderBy(value, ['activity.timestamp'], ['desc']),
});
}
revisionsByDate.value = orderBy(revisionsGrouped, ['date'], ['desc']);
revisions.value = orderBy(response.data.data, ['activity.action_on'], ['desc']);
revisions.value = orderBy(response.data.data, ['activity.timestamp'], ['desc']);
} catch (err) {
error.value = err;
} finally {

View File

@@ -58,8 +58,8 @@ export default defineComponent({
const date = await getFormattedDate(revision);
let user = i18n.t('private_user');
if (typeof revision.activity.action_by === 'object') {
const { first_name, last_name } = revision.activity.action_by;
if (typeof revision.activity.user === 'object') {
const { first_name, last_name } = revision.activity.user;
user = `${first_name} ${last_name}`;
}
@@ -80,8 +80,8 @@ export default defineComponent({
return { _current, options, selectedOption };
async function getFormattedDate(revision: Revision) {
const date = await localizedFormat(new Date(revision!.activity.action_on), String(i18n.t('date-fns_date')));
const time = await localizedFormat(new Date(revision!.activity.action_on), String(i18n.t('date-fns_time')));
const date = await localizedFormat(new Date(revision!.activity.timestamp), String(i18n.t('date-fns_date')));
const time = await localizedFormat(new Date(revision!.activity.timestamp), String(i18n.t('date-fns_time')));
return `${date} (${time})`;
}

View File

@@ -8,8 +8,8 @@ export type Revision = {
action: string;
ip: string;
user_agent: string;
action_on: string;
action_by:
timestamp: string;
user:
| number
| {
id: number;

View File

@@ -9,12 +9,12 @@ properties:
example: update
type: string
enum: [authenticate, comment, upload, create, update, delete, soft-delete, revert, invalid-credentials]
action_by:
user:
description: Unique identifier of the user account who caused this action.
example: 63716273-0f29-4648-8a2a-2af2948f6f78
type: string
nullable: true # States the SQL structure
action_on:
timestamp:
description: When the action happened.
example: '2019-12-05 22:52:09'
type: string
@@ -44,4 +44,4 @@ properties:
sidebar of the item edit page in the admin app.
example: null
type: string
nullable: true
nullable: true

View File

@@ -8,8 +8,8 @@ properties:
description: Name of the folder.
example: New York
type: string
parent_folder:
parent:
description: Unique identifier of the parent folder. This allows for nested folders.
example: null
type: string
nullable: true
nullable: true

View File

@@ -6,7 +6,7 @@ properties:
type: string
many_field:
description: Foreign key. Field that holds the primary key of the related collection.
example: action_by
example: user
type: string
many_primary:
description: The primary field.
@@ -34,4 +34,4 @@ properties:
collection.
example: null
type: string
nullable: true
nullable: true

View File

@@ -35,7 +35,7 @@ patch:
name:
type: string
description: Name of the folder. Can't be null or empty.
parent_folder:
parent:
type: integer
example: 3
description: Unique identifier of the parent folder. This allows for nested folders.
@@ -69,4 +69,4 @@ delete:
tags:
- Folders
parameters:
- $ref: '../../openapi.yaml#/components/parameters/UUId'
- $ref: '../../openapi.yaml#/components/parameters/UUId'

View File

@@ -44,7 +44,7 @@ post:
type: string
example: Amsterdam
description: Name of the folder.
parent_folder:
parent:
description: Unique identifier of the parent folder. This allows for nested folders.
type: integer
required: [name]
@@ -63,4 +63,4 @@ post:
'404':
$ref: '../../openapi.yaml#/components/responses/NotFoundError'
tags:
- Folders
- Folders