Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(backend/frontend): introduce full-text search preference for users and spaces

johaven70ee79968e2e
diff --git a/backend/migrations/0003_fancy_gauntlet.sql b/backend/migrations/0003_fancy_gauntlet.sql
new file mode 100644
index 00000000..fa76da7b
--- /dev/null
+++ b/backend/migrations/0003_fancy_gauntlet.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `users` ADD `storageIndexing` boolean DEFAULT true NOT NULL;--> statement-breakpoint
+ALTER TABLE `spaces` ADD `storageIndexing` boolean DEFAULT true NOT NULL;
\ No newline at end of file
diff --git a/backend/migrations/meta/0003_snapshot.json b/backend/migrations/meta/0003_snapshot.json
new file mode 100644
index 00000000..0b18ae64
--- /dev/null
+++ b/backend/migrations/meta/0003_snapshot.json
@@ -0,0 +1,2440 @@
+{
+ "version": "5",
+ "dialect": "mysql",
+ "id": "ffa22779-d12a-4b0e-9aed-657e020cc05d",
+ "prevId": "076fc362-3587-4607-8075-e08cb473342e",
+ "tables": {
+ "cache": {
+ "name": "cache",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "varchar(768)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expiration": {
+ "name": "expiration",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": -1
+ }
+ },
+ "indexes": {
+ "expiration_idx": {
+ "name": "expiration_idx",
+ "columns": [
+ "expiration"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "cache_key": {
+ "name": "cache_key",
+ "columns": [
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "login": {
+ "name": "login",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "firstName": {
+ "name": "firstName",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastName": {
+ "name": "lastName",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "passwordAttempts": {
+ "name": "passwordAttempts",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "role": {
+ "name": "role",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "isActive": {
+ "name": "isActive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "secrets": {
+ "name": "secrets",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "char(2)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "storageUsage": {
+ "name": "storageUsage",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "storageQuota": {
+ "name": "storageQuota",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "storageIndexing": {
+ "name": "storageIndexing",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "notification": {
+ "name": "notification",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "onlineStatus": {
+ "name": "onlineStatus",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "currentIp": {
+ "name": "currentIp",
+ "type": "varchar(45)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastIp": {
+ "name": "lastIp",
+ "type": "varchar(45)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "currentAccess": {
+ "name": "currentAccess",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastAccess": {
+ "name": "lastAccess",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "email_idx": {
+ "name": "email_idx",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ },
+ "login_idx": {
+ "name": "login_idx",
+ "columns": [
+ "login"
+ ],
+ "isUnique": true
+ },
+ "role_idx": {
+ "name": "role_idx",
+ "columns": [
+ "role"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "users_id": {
+ "name": "users_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "groups": {
+ "name": "groups",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "name_idx": {
+ "name": "name_idx",
+ "columns": [
+ "name"
+ ],
+ "isUnique": true
+ },
+ "parent_idx": {
+ "name": "parent_idx",
+ "columns": [
+ "parentId"
+ ],
+ "isUnique": false
+ },
+ "type_idx": {
+ "name": "type_idx",
+ "columns": [
+ "type"
+ ],
+ "isUnique": false
+ },
+ "visibility_idx": {
+ "name": "visibility_idx",
+ "columns": [
+ "visibility"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "groups_parentId_groups_id_fk": {
+ "name": "groups_parentId_groups_id_fk",
+ "tableFrom": "groups",
+ "tableTo": "groups",
+ "columnsFrom": [
+ "parentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "groups_id": {
+ "name": "groups_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "users_groups": {
+ "name": "users_groups",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "groupId": {
+ "name": "groupId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "group_idx": {
+ "name": "group_idx",
+ "columns": [
+ "groupId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "users_groups_userId_users_id_fk": {
+ "name": "users_groups_userId_users_id_fk",
+ "tableFrom": "users_groups",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "users_groups_groupId_groups_id_fk": {
+ "name": "users_groups_groupId_groups_id_fk",
+ "tableFrom": "users_groups",
+ "tableTo": "groups",
+ "columnsFrom": [
+ "groupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "users_groups_userId_groupId_pk": {
+ "name": "users_groups_userId_groupId_pk",
+ "columns": [
+ "userId",
+ "groupId"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "users_guests": {
+ "name": "users_guests",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "guestId": {
+ "name": "guestId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "guest_id": {
+ "name": "guest_id",
+ "columns": [
+ "guestId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "users_guests_userId_users_id_fk": {
+ "name": "users_guests_userId_users_id_fk",
+ "tableFrom": "users_guests",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "users_guests_guestId_users_id_fk": {
+ "name": "users_guests_guestId_users_id_fk",
+ "tableFrom": "users_guests",
+ "tableTo": "users",
+ "columnsFrom": [
+ "guestId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "users_guests_userId_guestId_pk": {
+ "name": "users_guests_userId_guestId_pk",
+ "columns": [
+ "userId",
+ "guestId"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {
+ "user_guest_check": {
+ "name": "user_guest_check",
+ "value": "`users_guests`.`userId` <> `users_guests`.`guestId`"
+ }
+ }
+ },
+ "spaces": {
+ "name": "spaces",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "alias": {
+ "name": "alias",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "storageUsage": {
+ "name": "storageUsage",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "storageQuota": {
+ "name": "storageQuota",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "storageIndexing": {
+ "name": "storageIndexing",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ },
+ "disabledAt": {
+ "name": "disabledAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "alias_idx": {
+ "name": "alias_idx",
+ "columns": [
+ "alias"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "spaces_id": {
+ "name": "spaces_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "spaces_members": {
+ "name": "spaces_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "groupId": {
+ "name": "groupId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "linkId": {
+ "name": "linkId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "varchar(32)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "group_idx": {
+ "name": "group_idx",
+ "columns": [
+ "groupId"
+ ],
+ "isUnique": false
+ },
+ "link_idx": {
+ "name": "link_idx",
+ "columns": [
+ "linkId"
+ ],
+ "isUnique": false
+ },
+ "role_idx": {
+ "name": "role_idx",
+ "columns": [
+ "role"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "spaces_members_spaceId_spaces_id_fk": {
+ "name": "spaces_members_spaceId_spaces_id_fk",
+ "tableFrom": "spaces_members",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "spaces_members_userId_users_id_fk": {
+ "name": "spaces_members_userId_users_id_fk",
+ "tableFrom": "spaces_members",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "spaces_members_groupId_groups_id_fk": {
+ "name": "spaces_members_groupId_groups_id_fk",
+ "tableFrom": "spaces_members",
+ "tableTo": "groups",
+ "columnsFrom": [
+ "groupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "spaces_members_linkId_links_id_fk": {
+ "name": "spaces_members_linkId_links_id_fk",
+ "tableFrom": "spaces_members",
+ "tableTo": "links",
+ "columnsFrom": [
+ "linkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "spaces_members_id": {
+ "name": "spaces_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_user_uniq": {
+ "name": "space_user_uniq",
+ "columns": [
+ "spaceId",
+ "userId"
+ ]
+ },
+ "space_group_uniq": {
+ "name": "space_group_uniq",
+ "columns": [
+ "spaceId",
+ "groupId"
+ ]
+ },
+ "space_link_uniq": {
+ "name": "space_link_uniq",
+ "columns": [
+ "spaceId",
+ "linkId"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "spaces_roots": {
+ "name": "spaces_roots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "alias": {
+ "name": "alias",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "externalPath": {
+ "name": "externalPath",
+ "type": "varchar(4096)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "varchar(32)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "alias_idx": {
+ "name": "alias_idx",
+ "columns": [
+ "alias"
+ ],
+ "isUnique": false
+ },
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "file_idx": {
+ "name": "file_idx",
+ "columns": [
+ "fileId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "spaces_roots_spaceId_spaces_id_fk": {
+ "name": "spaces_roots_spaceId_spaces_id_fk",
+ "tableFrom": "spaces_roots",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "spaces_roots_fileId_files_id_fk": {
+ "name": "spaces_roots_fileId_files_id_fk",
+ "tableFrom": "spaces_roots",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "spaces_roots_id": {
+ "name": "spaces_roots_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "space_root_alias_uniq": {
+ "name": "space_root_alias_uniq",
+ "columns": [
+ "id",
+ "alias"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "shares": {
+ "name": "shares",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parentId": {
+ "name": "parentId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceRootId": {
+ "name": "spaceRootId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "externalPath": {
+ "name": "externalPath",
+ "type": "varchar(4096)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "tinyint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "alias": {
+ "name": "alias",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ },
+ "disabledAt": {
+ "name": "disabledAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "alias_idx": {
+ "name": "alias_idx",
+ "columns": [
+ "alias"
+ ],
+ "isUnique": true
+ },
+ "parent_idx": {
+ "name": "parent_idx",
+ "columns": [
+ "parentId"
+ ],
+ "isUnique": false
+ },
+ "owner_idx": {
+ "name": "owner_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "space_root_idx": {
+ "name": "space_root_idx",
+ "columns": [
+ "spaceRootId"
+ ],
+ "isUnique": false
+ },
+ "file_idx": {
+ "name": "file_idx",
+ "columns": [
+ "fileId"
+ ],
+ "isUnique": false
+ },
+ "type_idx": {
+ "name": "type_idx",
+ "columns": [
+ "type"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "shares_ownerId_users_id_fk": {
+ "name": "shares_ownerId_users_id_fk",
+ "tableFrom": "shares",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_parentId_shares_id_fk": {
+ "name": "shares_parentId_shares_id_fk",
+ "tableFrom": "shares",
+ "tableTo": "shares",
+ "columnsFrom": [
+ "parentId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_spaceId_spaces_id_fk": {
+ "name": "shares_spaceId_spaces_id_fk",
+ "tableFrom": "shares",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_spaceRootId_spaces_roots_id_fk": {
+ "name": "shares_spaceRootId_spaces_roots_id_fk",
+ "tableFrom": "shares",
+ "tableTo": "spaces_roots",
+ "columnsFrom": [
+ "spaceRootId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_fileId_files_id_fk": {
+ "name": "shares_fileId_files_id_fk",
+ "tableFrom": "shares",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "shares_id": {
+ "name": "shares_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "shares_members": {
+ "name": "shares_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "shareId": {
+ "name": "shareId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "groupId": {
+ "name": "groupId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "linkId": {
+ "name": "linkId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "varchar(32)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "share_idx": {
+ "name": "share_idx",
+ "columns": [
+ "shareId"
+ ],
+ "isUnique": false
+ },
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "group_idx": {
+ "name": "group_idx",
+ "columns": [
+ "groupId"
+ ],
+ "isUnique": false
+ },
+ "link_idx": {
+ "name": "link_idx",
+ "columns": [
+ "linkId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "shares_members_shareId_shares_id_fk": {
+ "name": "shares_members_shareId_shares_id_fk",
+ "tableFrom": "shares_members",
+ "tableTo": "shares",
+ "columnsFrom": [
+ "shareId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_members_userId_users_id_fk": {
+ "name": "shares_members_userId_users_id_fk",
+ "tableFrom": "shares_members",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_members_groupId_groups_id_fk": {
+ "name": "shares_members_groupId_groups_id_fk",
+ "tableFrom": "shares_members",
+ "tableTo": "groups",
+ "columnsFrom": [
+ "groupId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shares_members_linkId_links_id_fk": {
+ "name": "shares_members_linkId_links_id_fk",
+ "tableFrom": "shares_members",
+ "tableTo": "links",
+ "columnsFrom": [
+ "linkId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "shares_members_id": {
+ "name": "shares_members_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {
+ "share_user_uniq": {
+ "name": "share_user_uniq",
+ "columns": [
+ "shareId",
+ "userId"
+ ]
+ },
+ "share_group_uniq": {
+ "name": "share_group_uniq",
+ "columns": [
+ "shareId",
+ "groupId"
+ ]
+ },
+ "share_link_uniq": {
+ "name": "share_link_uniq",
+ "columns": [
+ "shareId",
+ "linkId"
+ ]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "files": {
+ "name": "files",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceExternalRootId": {
+ "name": "spaceExternalRootId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "shareExternalId": {
+ "name": "shareExternalId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "varchar(4096)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "isDir": {
+ "name": "isDir",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inTrash": {
+ "name": "inTrash",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "mime": {
+ "name": "mime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "size": {
+ "name": "size",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "mtime": {
+ "name": "mtime",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "ctime": {
+ "name": "ctime",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "owner_idx": {
+ "name": "owner_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "space_external_root_idx": {
+ "name": "space_external_root_idx",
+ "columns": [
+ "spaceExternalRootId"
+ ],
+ "isUnique": false
+ },
+ "share_external_idx": {
+ "name": "share_external_idx",
+ "columns": [
+ "shareExternalId"
+ ],
+ "isUnique": false
+ },
+ "name_idx": {
+ "name": "name_idx",
+ "columns": [
+ "name"
+ ],
+ "isUnique": false
+ },
+ "path_idx": {
+ "name": "path_idx",
+ "columns": [
+ "path"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "files_ownerId_users_id_fk": {
+ "name": "files_ownerId_users_id_fk",
+ "tableFrom": "files",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_spaceId_spaces_id_fk": {
+ "name": "files_spaceId_spaces_id_fk",
+ "tableFrom": "files",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_spaceExternalRootId_spaces_roots_id_fk": {
+ "name": "files_spaceExternalRootId_spaces_roots_id_fk",
+ "tableFrom": "files",
+ "tableTo": "spaces_roots",
+ "columnsFrom": [
+ "spaceExternalRootId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_shareExternalId_shares_id_fk": {
+ "name": "files_shareExternalId_shares_id_fk",
+ "tableFrom": "files",
+ "tableTo": "shares",
+ "columnsFrom": [
+ "shareExternalId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "files_id": {
+ "name": "files_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "files_recents": {
+ "name": "files_recents",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "shareId": {
+ "name": "shareId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "path": {
+ "name": "path",
+ "type": "varchar(4096)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "mime": {
+ "name": "mime",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mtime": {
+ "name": "mtime",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "owner_idx": {
+ "name": "owner_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "share_idx": {
+ "name": "share_idx",
+ "columns": [
+ "shareId"
+ ],
+ "isUnique": false
+ },
+ "mtime_idx": {
+ "name": "mtime_idx",
+ "columns": [
+ "mtime"
+ ],
+ "isUnique": false
+ },
+ "path_idx": {
+ "name": "path_idx",
+ "columns": [
+ "path"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "files_recents_ownerId_users_id_fk": {
+ "name": "files_recents_ownerId_users_id_fk",
+ "tableFrom": "files_recents",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_recents_spaceId_spaces_id_fk": {
+ "name": "files_recents_spaceId_spaces_id_fk",
+ "tableFrom": "files_recents",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "files_recents_shareId_shares_id_fk": {
+ "name": "files_recents_shareId_shares_id_fk",
+ "tableFrom": "files_recents",
+ "tableTo": "shares",
+ "columnsFrom": [
+ "shareId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "links": {
+ "name": "links",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "uuid": {
+ "name": "uuid",
+ "type": "varchar(32)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "requireAuth": {
+ "name": "requireAuth",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "nbAccess": {
+ "name": "nbAccess",
+ "type": "int unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "limitAccess": {
+ "name": "limitAccess",
+ "type": "int unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "uuid_idx": {
+ "name": "uuid_idx",
+ "columns": [
+ "uuid"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "links_userId_users_id_fk": {
+ "name": "links_userId_users_id_fk",
+ "tableFrom": "links",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "links_id": {
+ "name": "links_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "comments": {
+ "name": "comments",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "modifiedAt": {
+ "name": "modifiedAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "user_idx": {
+ "name": "user_idx",
+ "columns": [
+ "userId"
+ ],
+ "isUnique": false
+ },
+ "file_idx": {
+ "name": "file_idx",
+ "columns": [
+ "fileId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "comments_userId_users_id_fk": {
+ "name": "comments_userId_users_id_fk",
+ "tableFrom": "comments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "comments_fileId_files_id_fk": {
+ "name": "comments_fileId_files_id_fk",
+ "tableFrom": "comments",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "comments_id": {
+ "name": "comments_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "notifications": {
+ "name": "notifications",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "fromUserId": {
+ "name": "fromUserId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "toUserId": {
+ "name": "toUserId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "wasRead": {
+ "name": "wasRead",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "from_user_idx": {
+ "name": "from_user_idx",
+ "columns": [
+ "fromUserId"
+ ],
+ "isUnique": false
+ },
+ "to_user_idx": {
+ "name": "to_user_idx",
+ "columns": [
+ "toUserId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "notifications_fromUserId_users_id_fk": {
+ "name": "notifications_fromUserId_users_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "users",
+ "columnsFrom": [
+ "fromUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notifications_toUserId_users_id_fk": {
+ "name": "notifications_toUserId_users_id_fk",
+ "tableFrom": "notifications",
+ "tableTo": "users",
+ "columnsFrom": [
+ "toUserId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "notifications_id": {
+ "name": "notifications_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "sync_clients": {
+ "name": "sync_clients",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "char(36)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "char(36)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tokenExpiration": {
+ "name": "tokenExpiration",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "info": {
+ "name": "info",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "currentIp": {
+ "name": "currentIp",
+ "type": "varchar(45)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastIp": {
+ "name": "lastIp",
+ "type": "varchar(45)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "currentAccess": {
+ "name": "currentAccess",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lastAccess": {
+ "name": "lastAccess",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "owner_idx": {
+ "name": "owner_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "token_idx": {
+ "name": "token_idx",
+ "columns": [
+ "token"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sync_clients_ownerId_users_id_fk": {
+ "name": "sync_clients_ownerId_users_id_fk",
+ "tableFrom": "sync_clients",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "sync_clients_id": {
+ "name": "sync_clients_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "sync_paths": {
+ "name": "sync_paths",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "char(36)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ownerId": {
+ "name": "ownerId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceId": {
+ "name": "spaceId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "spaceRootId": {
+ "name": "spaceRootId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "shareId": {
+ "name": "shareId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fileId": {
+ "name": "fileId",
+ "type": "bigint unsigned",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "datetime",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {
+ "client_idx": {
+ "name": "client_idx",
+ "columns": [
+ "clientId"
+ ],
+ "isUnique": false
+ },
+ "owner_idx": {
+ "name": "owner_idx",
+ "columns": [
+ "ownerId"
+ ],
+ "isUnique": false
+ },
+ "space_idx": {
+ "name": "space_idx",
+ "columns": [
+ "spaceId"
+ ],
+ "isUnique": false
+ },
+ "space_root_idx": {
+ "name": "space_root_idx",
+ "columns": [
+ "spaceRootId"
+ ],
+ "isUnique": false
+ },
+ "share_idx": {
+ "name": "share_idx",
+ "columns": [
+ "shareId"
+ ],
+ "isUnique": false
+ },
+ "file_idx": {
+ "name": "file_idx",
+ "columns": [
+ "fileId"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sync_paths_clientId_sync_clients_id_fk": {
+ "name": "sync_paths_clientId_sync_clients_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "sync_clients",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sync_paths_ownerId_users_id_fk": {
+ "name": "sync_paths_ownerId_users_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "users",
+ "columnsFrom": [
+ "ownerId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sync_paths_spaceId_spaces_id_fk": {
+ "name": "sync_paths_spaceId_spaces_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "spaces",
+ "columnsFrom": [
+ "spaceId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sync_paths_spaceRootId_spaces_roots_id_fk": {
+ "name": "sync_paths_spaceRootId_spaces_roots_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "spaces_roots",
+ "columnsFrom": [
+ "spaceRootId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sync_paths_shareId_shares_id_fk": {
+ "name": "sync_paths_shareId_shares_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "shares",
+ "columnsFrom": [
+ "shareId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sync_paths_fileId_files_id_fk": {
+ "name": "sync_paths_fileId_files_id_fk",
+ "tableFrom": "sync_paths",
+ "tableTo": "files",
+ "columnsFrom": [
+ "fileId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "sync_paths_id": {
+ "name": "sync_paths_id",
+ "columns": [
+ "id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ }
+ },
+ "views": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "tables": {},
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/backend/migrations/meta/_journal.json b/backend/migrations/meta/_journal.json
index 0c7ec08e..c95ad1c6 100644
--- a/backend/migrations/meta/_journal.json
+++ b/backend/migrations/meta/_journal.json
@@ -22,6 +22,13 @@
"when": 1758413556822,
"tag": "0002_sleepy_korath",
"breakpoints": true
+ },
+ {
+ "idx": 3,
+ "version": "5",
+ "when": 1760089921667,
+ "tag": "0003_fancy_gauntlet",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/backend/src/applications/files/services/files-content-manager.service.ts b/backend/src/applications/files/services/files-content-manager.service.ts
index 1bc32065..47019e8c 100644
--- a/backend/src/applications/files/services/files-content-manager.service.ts
+++ b/backend/src/applications/files/services/files-content-manager.service.ts
@@ -47,7 +47,7 @@ export class FilesContentManager {
}
indexSuffixes.push(indexSuffix)
}
- // cleanup old tables
+ // clean up old tables
await this.filesIndexer.cleanIndexes(indexSuffixes)
}
diff --git a/backend/src/applications/files/services/files-parser.service.ts b/backend/src/applications/files/services/files-parser.service.ts
index eb3f7e00..e99998da 100644
--- a/backend/src/applications/files/services/files-parser.service.ts
+++ b/backend/src/applications/files/services/files-parser.service.ts
@@ -42,7 +42,7 @@ export class FilesParser {
login: users.login
})
.from(users)
- .where(and(...[lte(users.role, USER_ROLE.USER), ...(userId ? [eq(users.id, userId)] : [])]))) {
+ .where(and(...[lte(users.role, USER_ROLE.USER), eq(users.storageIndexing, true), ...(userId ? [eq(users.id, userId)] : [])]))) {
const userFilesPath = UserModel.getFilesPath(user.login)
if (!(await isPathExists(userFilesPath))) {
this.logger.warn(`${this.userPaths.name} - user path does not exist : ${userFilesPath}`)
@@ -71,7 +71,7 @@ export class FilesParser {
.leftJoin(spacesRoots, eq(spacesRoots.spaceId, spaces.id))
.leftJoin(files, eq(files.id, spacesRoots.fileId))
.leftJoin(users, eq(users.id, files.ownerId))
- .where(and(...(spaceIds ? [inArray(spaces.id, spaceIds)] : [])))
+ .where(and(eq(spaces.storageIndexing, true), ...(spaceIds ? [inArray(spaces.id, spaceIds)] : [])))
.groupBy(spaces.id)) {
const spaceFilesPath = SpaceModel.getFilesPath(space.alias)
if (!(await isPathExists(spaceFilesPath))) {
@@ -111,13 +111,13 @@ export class FilesParser {
.leftJoin(
files,
or(
- // if the child share is from a share with an external path, the child share should have an external path and a fileId
+ // If the child share is from a share with an external path, the child share should have an external path and a fileId
and(isNotNull(shares.fileId), eq(files.id, shares.fileId)),
and(isNull(shares.externalPath), isNull(shares.fileId), isNotNull(spacesRoots.fileId), eq(files.id, spacesRoots.fileId))
)
)
- .leftJoin(spaces, and(isNull(shares.externalPath), isNotNull(files.spaceId), eq(spaces.id, files.spaceId)))
- .leftJoin(users, eq(users.id, files.ownerId))
+ .leftJoin(spaces, and(isNull(shares.externalPath), isNotNull(files.spaceId), eq(spaces.id, files.spaceId), eq(spaces.storageIndexing, true)))
+ .leftJoin(users, and(eq(users.id, files.ownerId), eq(users.storageIndexing, true)))
.where(and(...[eq(shares.type, SHARE_TYPE.COMMON), ...(shareIds ? [inArray(shares.id, shareIds)] : [])]))
.groupBy(shares.id)) {
let shareFilesPath: string
@@ -127,6 +127,9 @@ export class FilesParser {
shareFilesPath = path.join(UserModel.getFilesPath(share.file.fromOwner), share.file.path)
} else if (share.file.fromSpace) {
shareFilesPath = path.join(SpaceModel.getFilesPath(share.file.fromSpace), share.file.path)
+ } else {
+ // Exclude shares that don’t match these cases (join conditions)
+ continue
}
if (!(await isPathExists(shareFilesPath))) {
this.logger.warn(`${this.sharePaths.name} - share path does not exist : ${shareFilesPath}`)
diff --git a/backend/src/applications/spaces/dto/create-or-update-space.dto.ts b/backend/src/applications/spaces/dto/create-or-update-space.dto.ts
index ee715372..be2e0333 100644
--- a/backend/src/applications/spaces/dto/create-or-update-space.dto.ts
+++ b/backend/src/applications/spaces/dto/create-or-update-space.dto.ts
@@ -67,6 +67,10 @@ export class CreateOrUpdateSpaceDto {
@IsInt()
storageQuota?: number = null
+ @IsOptional()
+ @IsBoolean()
+ storageIndexing?: boolean
+
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
diff --git a/backend/src/applications/spaces/models/space-props.model.ts b/backend/src/applications/spaces/models/space-props.model.ts
index feb45e59..59163054 100644
--- a/backend/src/applications/spaces/models/space-props.model.ts
+++ b/backend/src/applications/spaces/models/space-props.model.ts
@@ -19,6 +19,7 @@ export class SpaceProps implements Space {
description: string
storageQuota: number
storageUsage: number
+ storageIndexing: boolean
modifiedAt: Date
disabledAt: Date
createdAt: Date
diff --git a/backend/src/applications/spaces/models/space.model.ts b/backend/src/applications/spaces/models/space.model.ts
index f8ae0d86..a61f20f3 100644
--- a/backend/src/applications/spaces/models/space.model.ts
+++ b/backend/src/applications/spaces/models/space.model.ts
@@ -19,6 +19,7 @@ export class SpaceModel implements Space {
description: string
storageQuota: number
storageUsage: number
+ storageIndexing: boolean
modifiedAt: Date
disabledAt: Date
createdAt: Date
diff --git a/backend/src/applications/spaces/schemas/space.interface.ts b/backend/src/applications/spaces/schemas/space.interface.ts
index 6a1d142f..f3ac4119 100644
--- a/backend/src/applications/spaces/schemas/space.interface.ts
+++ b/backend/src/applications/spaces/schemas/space.interface.ts
@@ -16,6 +16,7 @@ export class Space implements SpaceSchema {
description: string
storageUsage: number
storageQuota: number
+ storageIndexing: boolean
createdAt: Date
modifiedAt: Date
disabledAt: Date
diff --git a/backend/src/applications/spaces/schemas/spaces.schema.ts b/backend/src/applications/spaces/schemas/spaces.schema.ts
index d4d558e6..d38fda49 100644
--- a/backend/src/applications/spaces/schemas/spaces.schema.ts
+++ b/backend/src/applications/spaces/schemas/spaces.schema.ts
@@ -27,6 +27,7 @@ export const spaces = mysqlTable(
enabled: boolean('enabled').default(true).notNull(),
storageUsage: bigint('storageUsage', { mode: 'number', unsigned: true }).default(0).notNull(),
storageQuota: bigint('storageQuota', { mode: 'number', unsigned: true }),
+ storageIndexing: boolean('storageIndexing').default(true).notNull(),
createdAt: datetime('createdAt', { mode: 'date' })
.default(sql`CURRENT_TIMESTAMP`)
.notNull(),
diff --git a/backend/src/applications/spaces/services/spaces-manager.service.ts b/backend/src/applications/spaces/services/spaces-manager.service.ts
index 3e643573..6748435d 100644
--- a/backend/src/applications/spaces/services/spaces-manager.service.ts
+++ b/backend/src/applications/spaces/services/spaces-manager.service.ts
@@ -217,6 +217,7 @@ export class SpacesManager {
description: createOrUpdateSpaceDto.description,
enabled: createOrUpdateSpaceDto.enabled,
storageQuota: createOrUpdateSpaceDto.storageQuota,
+ storageIndexing: createOrUpdateSpaceDto.storageIndexing,
disabledAt: createOrUpdateSpaceDto.enabled ? null : new Date()
})
try {
@@ -239,9 +240,10 @@ export class SpacesManager {
async updateSpace(user: UserModel, spaceId: number, createOrUpdateSpaceDto: CreateOrUpdateSpaceDto): Promise<SpaceProps> {
/* only managers of the space can update it */
const space: SpaceProps = await this.userCanAccessSpace(user.id, spaceId, true)
- // check & update space info
+ // check and update space info
const spaceDiffProps: Partial<SpaceProps> = { modifiedAt: new Date() }
- for (const prop of ['name', 'description', 'enabled', 'storageQuota']) {
+ const props: (keyof CreateOrUpdateSpaceDto)[] = ['name', 'description', 'enabled', 'storageQuota', 'storageIndexing']
+ for (const prop of props) {
if (createOrUpdateSpaceDto[prop] !== space[prop]) {
spaceDiffProps[prop] = createOrUpdateSpaceDto[prop]
if (prop === 'name') {
diff --git a/backend/src/applications/spaces/services/spaces-queries.service.ts b/backend/src/applications/spaces/services/spaces-queries.service.ts
index bda216af..ea806a9f 100644
--- a/backend/src/applications/spaces/services/spaces-queries.service.ts
+++ b/backend/src/applications/spaces/services/spaces-queries.service.ts
@@ -126,6 +126,7 @@ export class SpacesQueries {
enabled: spaces.enabled,
storageUsage: spaces.storageUsage,
storageQuota: spaces.storageQuota,
+ storageIndexing: spaces.storageIndexing,
createdAt: spaces.createdAt,
modifiedAt: spaces.modifiedAt,
disabledAt: spaces.disabledAt,
@@ -169,7 +170,7 @@ export class SpacesQueries {
permissions: otherMembers.permissions,
createdAt: dateTimeUTC(otherMembers.createdAt)
})
- })
+ } satisfies SpaceProps | SelectedFields<any, any>)
.from(spacesMembers)
.innerJoin(
spaces,
diff --git a/backend/src/applications/users/constants/routes.ts b/backend/src/applications/users/constants/routes.ts
index 841048e5..c4968828 100644
--- a/backend/src/applications/users/constants/routes.ts
+++ b/backend/src/applications/users/constants/routes.ts
@@ -13,6 +13,7 @@ export const USERS_ROUTE = {
PASSWORD: 'password',
APP_PASSWORDS: 'app_passwords',
NOTIFICATION: 'notification',
+ STORAGE_INDEXING: 'storage_indexing',
AVATAR: 'avatar',
GROUPS: 'groups',
USERS: 'users',
@@ -26,6 +27,7 @@ export const API_USERS_MY_LANGUAGE = `${API_USERS_ME}/${USERS_ROUTE.LANGUAGE}`
export const API_USERS_MY_PASSWORD = `${API_USERS_ME}/${USERS_ROUTE.PASSWORD}`
export const API_USERS_MY_APP_PASSWORDS = `${API_USERS_ME}/${USERS_ROUTE.APP_PASSWORDS}`
export const API_USERS_MY_NOTIFICATION = `${API_USERS_ME}/${USERS_ROUTE.NOTIFICATION}`
+export const API_USERS_MY_STORAGE_INDEXING = `${API_USERS_ME}/${USERS_ROUTE.STORAGE_INDEXING}`
export const API_USERS_MY_AVATAR = `${API_USERS_ME}/${USERS_ROUTE.AVATAR}`
export const API_USERS_MY_GROUPS = `${API_USERS_ME}/${USERS_ROUTE.GROUPS}`
export const API_USERS_MY_GROUPS_BROWSE = `${API_USERS_MY_GROUPS}/${USERS_ROUTE.BROWSE}`
diff --git a/backend/src/applications/users/dto/user-properties.dto.ts b/backend/src/applications/users/dto/user-properties.dto.ts
index 205dc985..f9da2c68 100644
--- a/backend/src/applications/users/dto/user-properties.dto.ts
+++ b/backend/src/applications/users/dto/user-properties.dto.ts
@@ -5,7 +5,7 @@
*/
import { Transform } from 'class-transformer'
-import { IsDate, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MinLength, ValidateIf } from 'class-validator'
+import { IsBoolean, IsDate, IsDefined, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MinLength, ValidateIf } from 'class-validator'
import { AUTH_SCOPE } from '../../../authentication/constants/scope'
import { currentDate } from '../../../common/shared'
import { USER_PASSWORD_MIN_LENGTH } from '../constants/user'
@@ -21,6 +21,12 @@ export class UserNotificationDto {
notification: number
}
+export class UserStorageIndexingDto {
+ @IsDefined()
+ @IsBoolean()
+ storageIndexing: boolean
+}
+
export class UserUpdatePasswordDto {
@IsNotEmpty()
@IsString()
diff --git a/backend/src/applications/users/models/user.model.ts b/backend/src/applications/users/models/user.model.ts
index 0ad9349b..7b8b6d70 100644
--- a/backend/src/applications/users/models/user.model.ts
+++ b/backend/src/applications/users/models/user.model.ts
@@ -29,6 +29,7 @@ export class UserModel implements User {
permissions: string
storageUsage: number
storageQuota: number
+ storageIndexing: boolean
passwordAttempts: number
currentIp: string
lastIp: string
diff --git a/backend/src/applications/users/schemas/user.interface.ts b/backend/src/applications/users/schemas/user.interface.ts
index b3b6cdfa..a1c338d9 100644
--- a/backend/src/applications/users/schemas/user.interface.ts
+++ b/backend/src/applications/users/schemas/user.interface.ts
@@ -23,6 +23,7 @@ export class User implements UserSchema {
permissions: string
storageUsage: number
storageQuota: number
+ storageIndexing: boolean
notification: number
onlineStatus: number
passwordAttempts: number
diff --git a/backend/src/applications/users/schemas/users.schema.ts b/backend/src/applications/users/schemas/users.schema.ts
index b83a14c2..dba2cb56 100644
--- a/backend/src/applications/users/schemas/users.schema.ts
+++ b/backend/src/applications/users/schemas/users.schema.ts
@@ -46,6 +46,7 @@ export const users = mysqlTable(
permissions: varchar('permissions', { length: 255 }).default('').notNull(),
storageUsage: bigint('storageUsage', { mode: 'number', unsigned: true }).default(0),
storageQuota: bigint('storageQuota', { mode: 'number', unsigned: true }),
+ storageIndexing: boolean('storageIndexing').default(true).notNull(),
notification: tinyint('notification', { unsigned: true }).default(1).notNull(),
onlineStatus: tinyint('onlineStatus', { unsigned: true }).default(0).notNull(),
currentIp: varchar('currentIp', { length: 45 }),
diff --git a/backend/src/applications/users/services/users-manager.service.ts b/backend/src/applications/users/services/users-manager.service.ts
index f1e4e7c5..94f7af3c 100755
--- a/backend/src/applications/users/services/users-manager.service.ts
+++ b/backend/src/applications/users/services/users-manager.service.ts
@@ -29,7 +29,13 @@ import { USER_GROUP_ROLE, USER_MAX_PASSWORD_ATTEMPTS, USER_ONLINE_STATUS, USER_R
import type { UserCreateOrUpdateGroupDto } from '../dto/create-or-update-group.dto'
import type { CreateUserDto, UpdateUserDto, UpdateUserFromGroupDto } from '../dto/create-or-update-user.dto'
import type { SearchMembersDto } from '../dto/search-members.dto'
-import type { UserAppPasswordDto, UserLanguageDto, UserNotificationDto, UserUpdatePasswordDto } from '../dto/user-properties.dto'
+import type {
+ UserAppPasswordDto,
+ UserLanguageDto,
+ UserNotificationDto,
+ UserStorageIndexingDto,
+ UserUpdatePasswordDto
+} from '../dto/user-properties.dto'
import type { GroupBrowse } from '../interfaces/group-browse.interface'
import type { GroupMember, GroupWithMembers } from '../interfaces/group-member'
import type { GuestUser } from '../interfaces/guest-user.interface'
@@ -132,7 +138,13 @@ export class UsersManager {
async updateNotification(user: UserModel, userNotificationDto: UserNotificationDto) {
if (!(await this.usersQueries.updateUserOrGuest(user.id, userNotificationDto))) {
- throw new HttpException('Unable to update notification', HttpStatus.INTERNAL_SERVER_ERROR)
+ throw new HttpException('Unable to update notification preference', HttpStatus.INTERNAL_SERVER_ERROR)
+ }
+ }
+
+ async updateStorageIndexing(user: UserModel, userStorageIndexingDto: UserStorageIndexingDto) {
+ if (!(await this.usersQueries.updateUserOrGuest(user.id, userStorageIndexingDto))) {
+ throw new HttpException('Unable to update full-text search preference', HttpStatus.INTERNAL_SERVER_ERROR)
}
}
diff --git a/backend/src/applications/users/users.controller.ts b/backend/src/applications/users/users.controller.ts
index 19c60f49..fc87367d 100755
--- a/backend/src/applications/users/users.controller.ts
+++ b/backend/src/applications/users/users.controller.ts
@@ -17,7 +17,7 @@ import { GetUser } from './decorators/user.decorator'
import { UserCreateOrUpdateGroupDto } from './dto/create-or-update-group.dto'
import { CreateUserDto, UpdateUserDto, UpdateUserFromGroupDto } from './dto/create-or-update-user.dto'
import { SearchMembersDto } from './dto/search-members.dto'
-import { UserAppPasswordDto, UserLanguageDto, UserNotificationDto, UserUpdatePasswordDto } from './dto/user-properties.dto'
+import { UserAppPasswordDto, UserLanguageDto, UserNotificationDto, UserStorageIndexingDto, UserUpdatePasswordDto } from './dto/user-properties.dto'
import { UserPermissionsGuard } from './guards/permissions.guard'
import { UserRolesGuard } from './guards/roles.guard'
import { GroupBrowse } from './interfaces/group-browse.interface'
@@ -78,6 +78,12 @@ export class UsersController {
return this.usersManager.updateNotification(user, userNotificationDto)
}
+ @Put(`${USERS_ROUTE.ME}/${USERS_ROUTE.STORAGE_INDEXING}`)
+ @UserHaveRole(USER_ROLE.USER)
+ updateStorageIndexing(@GetUser() user: UserModel, @Body() userStorageIndexingDto: UserStorageIndexingDto) {
+ return this.usersManager.updateStorageIndexing(user, userStorageIndexingDto)
+ }
+
@Get(`${USERS_ROUTE.AVATAR}/:login`)
@UserHaveRole(USER_ROLE.LINK)
@Header('cache-control', 'public,max-age=86400')
diff --git a/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.html b/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.html
index 48e27dd1..36488f0c 100644
--- a/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.html
+++ b/frontend/src/app/applications/shares/components/dialogs/share-dialog.component.html
@@ -33,35 +33,37 @@
</ng-template>
<div class="d-flex col-12">
<div class="d-flex flex-column col-6 pe-2">
- <div class="mb-3 px-0" style="max-width: 80%">
- <label for="name" l10nTranslate>
- Share name
- </label>
- <input
- id="name"
- type="text"
- [(ngModel)]="share.name"
- appAutofocus
- class="form-control form-control-sm {{ !share.name ? 'is-invalid' : '' }}"
- required>
- </div>
- <div class="mb-3 px-0" style="max-width: 80%">
- <label for="description" l10nTranslate>
- Description
- </label>
- <input
- id="description"
- type="text"
- [(ngModel)]="share.description"
- class="form-control form-control-sm">
- </div>
- <div class="mb-3 px-0">
- <label for="switchStatus" l10nTranslate>Share status</label>
- <div class="d-flex align-items-center form-check form-switch cursor-pointer">
- <input class="form-check-input" [(ngModel)]="share.enabled" id="switchStatus" type="checkbox" role="button">
- <label class="form-check-label mb-0 ms-2" for="switchStatus" l10nTranslate>
- {{ share.enabled ? 'enabled' : 'disabled' }}
+ <div style="max-width: 80%">
+ <div class="mb-3 px-0">
+ <label for="name" l10nTranslate>
+ Share name
</label>
+ <input
+ id="name"
+ type="text"
+ [(ngModel)]="share.name"
+ appAutofocus
+ class="form-control form-control-sm {{ !share.name ? 'is-invalid' : '' }}"
+ required>
+ </div>
+ <div class="mb-3 px-0">
+ <label for="description" l10nTranslate>
+ Description
+ </label>
+ <input
+ id="description"
+ type="text"
+ [(ngModel)]="share.description"
+ class="form-control form-control-sm">
+ </div>
+ <div class="mb-3 px-0">
+ <label for="switchStatus" l10nTranslate>Share status</label>
+ <div class="d-flex align-items-center form-check form-switch cursor-pointer">
+ <input class="form-check-input" [(ngModel)]="share.enabled" id="switchStatus" type="checkbox" role="button">
+ <label class="form-check-label mb-0 ms-2" for="switchStatus" l10nTranslate>
+ {{ share.enabled ? 'enabled' : 'disabled' }}
+ </label>
+ </div>
</div>
</div>
</div>
diff --git a/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.html b/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.html
index 04788fe5..f7e90f6a 100644
--- a/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.html
+++ b/frontend/src/app/applications/spaces/components/dialogs/space-dialog.component.html
@@ -32,57 +32,58 @@
</ng-template>
<div class="d-flex col-12">
<div class="d-flex flex-column col-6 pe-2">
- <div class="mb-3 px-0" style="max-width: 80%">
- <label for="name" l10nTranslate>
- Space name
- </label>
- <input
- id="name"
- type="text"
- [(ngModel)]="space.name"
- appAutofocus
- class="form-control form-control-sm {{ !space.name ? 'is-invalid' : '' }}"
- required>
- </div>
- <div class="mb-3 px-0" style="max-width: 80%">
- <label for="description" l10nTranslate>
- Description
- </label>
- <input
- id="description"
- type="text"
- [(ngModel)]="space.description"
- class="form-control form-control-sm">
- </div>
- <div class="d-flex flex-column align-items-start mb-3" style="max-width: 80%">
- <app-storage-quota [(quota)]="space.storageQuota" [fullWidth]="true" class="w-100"></app-storage-quota>
- </div>
- @if (space.storageUsage) {
- <div class="d-flex flex-column mb-3" style="max-width: 80%">
- <label for="storage" l10nTranslate>Storage Usage</label>
- <app-storage-usage id="storage" [item]="space"></app-storage-usage>
+ <div style="max-width: 85%">
+ <div class="mb-3 px-0">
+ <label for="name" l10nTranslate>
+ Space name
+ </label>
+ <input
+ id="name"
+ type="text"
+ [(ngModel)]="space.name"
+ appAutofocus
+ class="form-control form-control-sm {{ !space.name ? 'is-invalid' : '' }}"
+ required>
</div>
- }
- <div class="mb-3 px-0">
- <label for="switchStatus" l10nTranslate>Space status</label>
- <div class="d-flex align-items-center form-check form-switch cursor-pointer">
- <input class="form-check-input" [(ngModel)]="space.enabled" id="switchStatus" type="checkbox" role="button">
- <label class="form-check-label mb-0 ms-2" for="switchStatus" l10nTranslate>
- {{ space.enabled ? 'enabled' : 'disabled' }}
+ <div class="mb-3 px-0">
+ <label for="description" l10nTranslate>
+ Description
</label>
+ <input
+ id="description"
+ type="text"
+ [(ngModel)]="space.description"
+ class="form-control form-control-sm">
+ </div>
+ <div class="d-flex flex-column align-items-start mb-3">
+ <app-storage-quota [(quota)]="space.storageQuota" [fullWidth]="true" class="w-100"></app-storage-quota>
</div>
- @if (!space.enabled) {
- <div class="text-danger mt-2">
- <span l10nTranslate>Space and data will be deleted in</span>
- <span class="fw-bold">
- @if (space.disabledAt) {
- <span>&nbsp;{{ space.disabledAt | amAdd: SPACE_MAX_DISABLED_DAYS : 'days'| amTimeAgo:true }}</span>
- } @else {
- <span>&nbsp;{{ SPACE_MAX_DISABLED_DAYS | amDuration:'days' }}</span>
- }
- </span>
+ @if (space.storageUsage) {
+ <div class="d-flex flex-column mb-3">
+ <label for="storage" l10nTranslate>Storage Usage</label>
+ <app-storage-usage id="storage" [item]="space"></app-storage-usage>
</div>
}
+ <div class="d-flex justify-content-between">
+ <div>
+ <label for="switchStatus" l10nTranslate>Space status</label>
+ <div class="d-flex align-items-center form-check form-switch cursor-pointer">
+ <input class="form-check-input" [(ngModel)]="space.enabled" id="switchStatus" type="checkbox" role="button">
+ <label class="form-check-label mb-0 ms-2" for="switchStatus" l10nTranslate>
+ {{ space.enabled ? 'enabled' : 'disabled' }}
+ </label>
+ </div>
+ </div>
+ <div>
+ <label for="switchFullText" l10nTranslate>Full-text search</label>
+ <div class="d-flex align-items-center form-check form-switch cursor-pointer">
+ <input class="form-check-input" [(ngModel)]="space.storageIndexing" id="switchFullText" type="checkbox" role="button">
+ <label class="form-check-label mb-0 ms-2" for="switchFullText" l10nTranslate>
+ {{ space.storageIndexing ? 'enabled' : 'disabled' }}
+ </label>
+ </div>
+ </div>
+ </div>
</div>
</div>
<div class="d-flex flex-column col-6">
@@ -169,6 +170,18 @@
class="btn btn-sm btn-danger" type="button" l10nTranslate>
Remove
</button>
+ @if (!space.enabled) {
+ <div class="text-danger white-space-truncate fs-sm mx-auto">
+ <span l10nTranslate>Space and data will be deleted in</span>
+ <span class="fw-bold">
+ @if (space.disabledAt) {
+ <span>&nbsp;{{ space.disabledAt | amAdd: SPACE_MAX_DISABLED_DAYS : 'days'| amTimeAgo:true }}</span>
+ } @else {
+ <span>&nbsp;{{ SPACE_MAX_DISABLED_DAYS | amDuration:'days' }}</span>
+ }
+ </span>
+ </div>
+ }
}
@if (tabView === 'links') {
<button (click)="openCreateLinkDialog()"
diff --git a/frontend/src/app/applications/spaces/models/space.model.ts b/frontend/src/app/applications/spaces/models/space.model.ts
index e3df191d..f530d534 100644
--- a/frontend/src/app/applications/spaces/models/space.model.ts
+++ b/frontend/src/app/applications/spaces/models/space.model.ts
@@ -33,6 +33,7 @@ export class SpaceModel implements Partial<SpaceProps> {
enabled: boolean
storageUsage: number
storageQuota: number
+ storageIndexing: boolean
modifiedAt: Date
disabledAt: Date
createdAt: Date
diff --git a/frontend/src/app/applications/users/components/user-account.component.html b/frontend/src/app/applications/users/components/user-account.component.html
index 0ff47c33..df09dca8 100755
--- a/frontend/src/app/applications/users/components/user-account.component.html
+++ b/frontend/src/app/applications/users/components/user-account.component.html
@@ -92,7 +92,7 @@
<div class="box-body">
@if (user.isUser) {
<div class="row mb-3">
- <span class="col-3 align-self-center" l10nTranslate>Avatar</span>
+ <span class="col-4 align-self-start" l10nTranslate>Avatar</span>
<div class="col-auto">
<button (click)="genAvatar()" class="btn btn-xs btn-success me-1" type="button" l10nTranslate>Generate</button>
<button class="btn-file-upload btn btn-xs btn-secondary" type="button">
@@ -103,7 +103,7 @@
</div>
}
<div class="row mb-3">
- <span class="col-3 align-self-center" l10nTranslate>Language</span>
+ <span class="col-4 align-self-start" l10nTranslate>Language</span>
<div class="col-auto">
<select [(ngModel)]="language" class="form-select form-select-sm">
@for (l of languages; track $index) {
@@ -113,7 +113,7 @@
</div>
</div>
<div class="row mb-3">
- <span class="col-3 align-self-center" l10nTranslate>Notification</span>
+ <span class="col-4 align-self-start" l10nTranslate>Notification</span>
<div class="col-auto">
<select [ngModel]="user?.notification"
(ngModelChange)="updateNotification($event)"
@@ -126,7 +126,24 @@
</div>
@if (user.isUser) {
<div class="row mb-3">
- <span class="col-3 align-self-start text-nowrap" l10nTranslate>Password</span>
+ <span class="col-4 text-nowrap align-self-start" l10nTranslate>Full-text search</span>
+ <div class="col-auto">
+ <div class="d-flex align-items-center form-check form-switch cursor-pointer">
+ <input
+ [ngModel]="user.storageIndexing"
+ (ngModelChange)="updateStorageIndexing($event)"
+ class="form-check-input"
+ id="switchFullText"
+ type="checkbox"
+ role="button">
+ <label class="form-check-label mb-0 ms-2" for="switchFullText">
+ <span l10nTranslate>{{ user.storageIndexing ? 'enabled' : 'disabled' }}&nbsp;<span l10nTranslate>for personal files</span></span>
+ </label>
+ </div>
+ </div>
+ </div>
+ <div class="row mb-3">
+ <span class="col-4 text-nowrap align-self-start " l10nTranslate>Password</span>
<div class="col-auto">
<div class="mb-1">
<app-input-password [(password)]="oldPassword"
@@ -150,14 +167,14 @@
</div>
</div>
<div class="row mb-3">
- <span class="col-3 align-self-start text-nowrap" l10nTranslate>Security</span>
+ <span class="col-4 align-self-start text-nowrap" l10nTranslate>Security</span>
<div class="col-auto">
<div class="fw-500 mb-2" l10nTranslate>Two-Factor Authentication</div>
<button (click)="enable2Fa()"
[disabled]="!store.server().twoFaEnabled"
class="btn btn-xs btn-primary"
type="button" l10nTranslate>
- {{user.twoFaEnabled ? 'Reset' : 'Enable'}}
+ {{ user.twoFaEnabled ? 'Reset' : 'Enable' }}
</button>
@if (user.twoFaEnabled) {
<button (click)="disable2Fa()"
@@ -172,7 +189,7 @@
class="btn btn-xs btn-primary me-1"
type="button" l10nTranslate>
@if (user.appPasswords > 0) {
- <span l10nTranslate>Manage</span>&nbsp;<span>({{user.appPasswords}})</span>
+ <span l10nTranslate>Manage</span>&nbsp;<span>({{ user.appPasswords }})</span>
} @else {
<span l10nTranslate>Generate</span>
}
diff --git a/frontend/src/app/applications/users/components/user-account.component.ts b/frontend/src/app/applications/users/components/user-account.component.ts
index c1dca24e..06c86cb8 100644
--- a/frontend/src/app/applications/users/components/user-account.component.ts
+++ b/frontend/src/app/applications/users/components/user-account.component.ts
@@ -160,6 +160,16 @@ export class UserAccountComponent implements OnDestroy {
})
}
+ updateStorageIndexing(status: boolean) {
+ this.userService.changeStorageIndexing({ storageIndexing: status }).subscribe({
+ next: () => {
+ this.user.storageIndexing = status
+ this.layout.sendNotification('info', 'Configuration', 'Full-text search preference updated')
+ },
+ error: (e: HttpErrorResponse) => this.layout.sendNotification('error', 'Configuration', 'Unable to update full-text search preference', e)
+ })
+ }
+
clipBoardLink() {
this.clipBoardService.copyFromContent(this.webdavUrl)
this.layout.sendNotification('info', 'Link copied', this.webdavUrl)
diff --git a/frontend/src/app/applications/users/user.service.ts b/frontend/src/app/applications/users/user.service.ts
index 23400fc2..68316ba8 100644
--- a/frontend/src/app/applications/users/user.service.ts
+++ b/frontend/src/app/applications/users/user.service.ts
@@ -20,6 +20,7 @@ import {
API_USERS_MY_LANGUAGE,
API_USERS_MY_NOTIFICATION,
API_USERS_MY_PASSWORD,
+ API_USERS_MY_STORAGE_INDEXING,
USERS_ROUTE
} from '@sync-in-server/backend/src/applications/users/constants/routes'
import { USER_ONLINE_STATUS, USER_PERMISSION } from '@sync-in-server/backend/src/applications/users/constants/user'
@@ -31,10 +32,11 @@ import type {
UpdateUserFromGroupDto
} from '@sync-in-server/backend/src/applications/users/dto/create-or-update-user.dto'
import type { SearchMembersDto } from '@sync-in-server/backend/src/applications/users/dto/search-members.dto'
-import type {
+import {
UserAppPasswordDto,
UserLanguageDto,
UserNotificationDto,
+ UserStorageIndexingDto,
UserUpdatePasswordDto
} from '@sync-in-server/backend/src/applications/users/dto/user-properties.dto'
import type { GroupBrowse } from '@sync-in-server/backend/src/applications/users/interfaces/group-browse.interface'
@@ -216,6 +218,10 @@ export class UserService {
return this.http.put(API_USERS_MY_NOTIFICATION, userNotificationDto)
}
+ changeStorageIndexing(userStorageIndexingDto: UserStorageIndexingDto): Observable<any> {
+ return this.http.put(API_USERS_MY_STORAGE_INDEXING, userStorageIndexingDto)
+ }
+
changeOnlineStatus(status: USER_ONLINE_STATUS, store: boolean = true) {
this.webSocket.emit(USERS_WS.EVENTS.ONLINE_STATUS, { status: status, store: store } satisfies EventChangeOnlineStatus)
}
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index f526027c..a30d6928 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -28,6 +28,7 @@
"Search": "Rechercher",
"Search for content": "Rechercher du contenu",
"Search for files": "Rechercher des fichiers",
+ "Full-text search": "Recherche full-text",
"Type to search for users or groups to add": "Tapez pour rechercher des utilisateurs ou des groupes à ajouter",
"Type to search for groups to add": "Tapez pour rechercher des groupes à ajouter",
"Type to search for users to add": "Tapez pour rechercher des utilisateurs à ajouter",
@@ -67,6 +68,7 @@
"Files": "Fichiers",
"Members files": "Fichiers des membres",
"Personal files": "Fichiers personnels",
+ "for personal files": "pour les fichiers personnels",
"Personal": "Personnels",
"External": "Externe",
"Share files": "Fichiers des partages",
@@ -185,7 +187,9 @@
"Language updated": "Langue mise à jour",
"Unable to update language": "Impossible de mettre à jour la langue",
"Notification preference updated": "Préférence de notification mise à jour",
+ "Full-text search preference updated": "Préférence de recherche full-text mise à jour",
"Unable to update notification preference": "Impossible de mettre à jour la préférence de notification",
+ "Unable to update full-text search preference": "Impossible de mettre à jour la préférence de recherche full-text",
"Unable to open document, missing configuration": "Impossible d'ouvrir le document, configuration manquante",
"Unable to open document": "Impossible d'ouvrir le document",
"Home": "Accueil",