diff --git a/CHANGELOG.md b/CHANGELOG.md index de8103abb..9020fd16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## v1.0.0-115 + + +### 🩹 Fixes + +- Fix delete table ([cdc544d](https://github.com/undb-io/undb/commit/cdc544d)) + +### ❤️ Contributors + +- Nichenqin ([@nichenqin](http://github.com/nichenqin)) + ## v1.0.0-114 diff --git a/apps/backend/drizzle/0013_lovely_mordo.sql b/apps/backend/drizzle/0013_lovely_mordo.sql new file mode 100644 index 000000000..dae9a245f --- /dev/null +++ b/apps/backend/drizzle/0013_lovely_mordo.sql @@ -0,0 +1,24 @@ +PRAGMA foreign_keys=OFF;--> statement-breakpoint +CREATE TABLE `__new_undb_reference_id_mapping` ( + `field_id` text NOT NULL, + `table_id` text NOT NULL, + `symmetric_field_id` text, + `foreign_table_id` text NOT NULL +); +--> statement-breakpoint +INSERT INTO `__new_undb_reference_id_mapping`("field_id", "table_id", "symmetric_field_id", "foreign_table_id") SELECT "field_id", "table_id", "symmetric_field_id", "foreign_table_id" FROM `undb_reference_id_mapping`;--> statement-breakpoint +DROP TABLE `undb_reference_id_mapping`;--> statement-breakpoint +ALTER TABLE `__new_undb_reference_id_mapping` RENAME TO `undb_reference_id_mapping`;--> statement-breakpoint +PRAGMA foreign_keys=ON;--> statement-breakpoint +CREATE UNIQUE INDEX `reference_id_mapping_unique_idx` ON `undb_reference_id_mapping` (`field_id`,`table_id`,`symmetric_field_id`,`foreign_table_id`);--> statement-breakpoint +CREATE TABLE `__new_undb_rollup_id_mapping` ( + `field_id` text NOT NULL, + `table_id` text NOT NULL, + `rollup_id` text NOT NULL, + `rollup_table_id` text NOT NULL, + PRIMARY KEY(`field_id`, `rollup_id`) +); +--> statement-breakpoint +INSERT INTO `__new_undb_rollup_id_mapping`("field_id", "table_id", "rollup_id", "rollup_table_id") SELECT "field_id", "table_id", "rollup_id", "rollup_table_id" FROM `undb_rollup_id_mapping`;--> statement-breakpoint +DROP TABLE `undb_rollup_id_mapping`;--> statement-breakpoint +ALTER TABLE `__new_undb_rollup_id_mapping` RENAME TO `undb_rollup_id_mapping`; \ No newline at end of file diff --git a/apps/backend/drizzle/meta/0013_snapshot.json b/apps/backend/drizzle/meta/0013_snapshot.json new file mode 100644 index 000000000..fad4cc6dd --- /dev/null +++ b/apps/backend/drizzle/meta/0013_snapshot.json @@ -0,0 +1,1986 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "bd2a3611-5cbc-4f1c-b8ac-55dbcbc1e9fe", + "prevId": "8a18df59-15d7-4217-ba21-3fc16d9b55d0", + "tables": { + "undb_api_token": { + "name": "undb_api_token", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "undb_api_token_token_unique": { + "name": "undb_api_token_token_unique", + "columns": [ + "token" + ], + "isUnique": true + }, + "api_token_space_id_idx": { + "name": "api_token_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "api_token_user_id_idx": { + "name": "api_token_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_api_token_user_id_undb_user_id_fk": { + "name": "undb_api_token_user_id_undb_user_id_fk", + "tableFrom": "undb_api_token", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_api_token_space_id_undb_space_id_fk": { + "name": "undb_api_token_space_id_undb_space_id_fk", + "tableFrom": "undb_api_token", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_attachment_mapping": { + "name": "undb_attachment_mapping", + "columns": { + "attachment_id": { + "name": "attachment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "record_id": { + "name": "record_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "field_id": { + "name": "field_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "undb_attachment_mapping_attachment_id_undb_attachment_id_fk": { + "name": "undb_attachment_mapping_attachment_id_undb_attachment_id_fk", + "tableFrom": "undb_attachment_mapping", + "tableTo": "undb_attachment", + "columnsFrom": [ + "attachment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_attachment_mapping_table_id_undb_table_id_fk": { + "name": "undb_attachment_mapping_table_id_undb_table_id_fk", + "tableFrom": "undb_attachment_mapping", + "tableTo": "undb_table", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "undb_attachment_mapping_attachment_id_table_id_record_id_field_id_pk": { + "columns": [ + "attachment_id", + "table_id", + "record_id", + "field_id" + ], + "name": "undb_attachment_mapping_attachment_id_table_id_record_id_field_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_attachment": { + "name": "undb_attachment", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "attachment_size_idx": { + "name": "attachment_size_idx", + "columns": [ + "size" + ], + "isUnique": false + }, + "attachment_space_id_idx": { + "name": "attachment_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_attachment_created_by_undb_user_id_fk": { + "name": "undb_attachment_created_by_undb_user_id_fk", + "tableFrom": "undb_attachment", + "tableTo": "undb_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_attachment_space_id_undb_space_id_fk": { + "name": "undb_attachment_space_id_undb_space_id_fk", + "tableFrom": "undb_attachment", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_audit": { + "name": "undb_audit", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "timestamp": { + "name": "timestamp", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "meta": { + "name": "meta", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "op": { + "name": "op", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "record_id": { + "name": "record_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "operator_id": { + "name": "operator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "audit_table_id_idx": { + "name": "audit_table_id_idx", + "columns": [ + "table_id" + ], + "isUnique": false + }, + "audit_space_id_idx": { + "name": "audit_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "audit_record_id_idx": { + "name": "audit_record_id_idx", + "columns": [ + "record_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_audit_space_id_undb_space_id_fk": { + "name": "undb_audit_space_id_undb_space_id_fk", + "tableFrom": "undb_audit", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_base": { + "name": "undb_base", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(CURRENT_TIMESTAMP)" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "base_space_id_idx": { + "name": "base_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "base_name_unique_idx": { + "name": "base_name_unique_idx", + "columns": [ + "name", + "space_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_base_space_id_undb_space_id_fk": { + "name": "undb_base_space_id_undb_space_id_fk", + "tableFrom": "undb_base", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_base_created_by_undb_user_id_fk": { + "name": "undb_base_created_by_undb_user_id_fk", + "tableFrom": "undb_base", + "tableTo": "undb_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_base_updated_by_undb_user_id_fk": { + "name": "undb_base_updated_by_undb_user_id_fk", + "tableFrom": "undb_base", + "tableTo": "undb_user", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_dashboard_table_id_mapping": { + "name": "undb_dashboard_table_id_mapping", + "columns": { + "dashboard_id": { + "name": "dashboard_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "undb_dashboard_table_id_mapping_dashboard_id_undb_dashboard_id_fk": { + "name": "undb_dashboard_table_id_mapping_dashboard_id_undb_dashboard_id_fk", + "tableFrom": "undb_dashboard_table_id_mapping", + "tableTo": "undb_dashboard", + "columnsFrom": [ + "dashboard_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_dashboard_table_id_mapping_table_id_undb_table_id_fk": { + "name": "undb_dashboard_table_id_mapping_table_id_undb_table_id_fk", + "tableFrom": "undb_dashboard_table_id_mapping", + "tableTo": "undb_table", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "undb_dashboard_table_id_mapping_dashboard_id_table_id_pk": { + "columns": [ + "dashboard_id", + "table_id" + ], + "name": "undb_dashboard_table_id_mapping_dashboard_id_table_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_dashboard": { + "name": "undb_dashboard", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "base_id": { + "name": "base_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "widgets": { + "name": "widgets", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "layout": { + "name": "layout", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(CURRENT_TIMESTAMP)" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "dashboard_base_id_idx": { + "name": "dashboard_base_id_idx", + "columns": [ + "base_id" + ], + "isUnique": false + }, + "dashboard_space_id_idx": { + "name": "dashboard_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "dashboard_name_unique_idx": { + "name": "dashboard_name_unique_idx", + "columns": [ + "name", + "base_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_dashboard_base_id_undb_base_id_fk": { + "name": "undb_dashboard_base_id_undb_base_id_fk", + "tableFrom": "undb_dashboard", + "tableTo": "undb_base", + "columnsFrom": [ + "base_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_dashboard_space_id_undb_space_id_fk": { + "name": "undb_dashboard_space_id_undb_space_id_fk", + "tableFrom": "undb_dashboard", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_dashboard_created_by_undb_user_id_fk": { + "name": "undb_dashboard_created_by_undb_user_id_fk", + "tableFrom": "undb_dashboard", + "tableTo": "undb_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_dashboard_updated_by_undb_user_id_fk": { + "name": "undb_dashboard_updated_by_undb_user_id_fk", + "tableFrom": "undb_dashboard", + "tableTo": "undb_user", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_email_verification_code": { + "name": "undb_email_verification_code", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "undb_email_verification_code_user_id_unique": { + "name": "undb_email_verification_code_user_id_unique", + "columns": [ + "user_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_email_verification_code_user_id_undb_user_id_fk": { + "name": "undb_email_verification_code_user_id_undb_user_id_fk", + "tableFrom": "undb_email_verification_code", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_invitation": { + "name": "undb_invitation", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invited_at": { + "name": "invited_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "inviter_id": { + "name": "inviter_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "invitation_space_id_idx": { + "name": "invitation_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "invitation_unique_idx": { + "name": "invitation_unique_idx", + "columns": [ + "email", + "space_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_invitation_space_id_undb_space_id_fk": { + "name": "undb_invitation_space_id_undb_space_id_fk", + "tableFrom": "undb_invitation", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_invitation_inviter_id_undb_user_id_fk": { + "name": "undb_invitation_inviter_id_undb_user_id_fk", + "tableFrom": "undb_invitation", + "tableTo": "undb_user", + "columnsFrom": [ + "inviter_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_oauth_account": { + "name": "undb_oauth_account", + "columns": { + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_user_id": { + "name": "provider_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "undb_oauth_account_user_id_undb_user_id_fk": { + "name": "undb_oauth_account_user_id_undb_user_id_fk", + "tableFrom": "undb_oauth_account", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "undb_oauth_account_provider_id_provider_user_id_pk": { + "columns": [ + "provider_id", + "provider_user_id" + ], + "name": "undb_oauth_account_provider_id_provider_user_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_outbox": { + "name": "undb_outbox", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "meta": { + "name": "meta", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "timestamp": { + "name": "timestamp", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "outbox_space_id_idx": { + "name": "outbox_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_outbox_space_id_undb_space_id_fk": { + "name": "undb_outbox_space_id_undb_space_id_fk", + "tableFrom": "undb_outbox", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_password_reset_token": { + "name": "undb_password_reset_token", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "undb_password_reset_token_token_unique": { + "name": "undb_password_reset_token_token_unique", + "columns": [ + "token" + ], + "isUnique": true + }, + "password_reset_token_user_id_idx": { + "name": "password_reset_token_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_password_reset_token_user_id_undb_user_id_fk": { + "name": "undb_password_reset_token_user_id_undb_user_id_fk", + "tableFrom": "undb_password_reset_token", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_reference_id_mapping": { + "name": "undb_reference_id_mapping", + "columns": { + "field_id": { + "name": "field_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "symmetric_field_id": { + "name": "symmetric_field_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "foreign_table_id": { + "name": "foreign_table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "reference_id_mapping_unique_idx": { + "name": "reference_id_mapping_unique_idx", + "columns": [ + "field_id", + "table_id", + "symmetric_field_id", + "foreign_table_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_rollup_id_mapping": { + "name": "undb_rollup_id_mapping", + "columns": { + "field_id": { + "name": "field_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rollup_id": { + "name": "rollup_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rollup_table_id": { + "name": "rollup_table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "undb_rollup_id_mapping_field_id_rollup_id_pk": { + "columns": [ + "field_id", + "rollup_id" + ], + "name": "undb_rollup_id_mapping_field_id_rollup_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_session": { + "name": "undb_session", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "undb_session_user_id_undb_user_id_fk": { + "name": "undb_session_user_id_undb_user_id_fk", + "tableFrom": "undb_session", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_session_space_id_undb_space_id_fk": { + "name": "undb_session_space_id_undb_space_id_fk", + "tableFrom": "undb_session", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_share": { + "name": "undb_share", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "share_space_id_idx": { + "name": "share_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "share_unique_idx": { + "name": "share_unique_idx", + "columns": [ + "target_type", + "target_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_share_space_id_undb_space_id_fk": { + "name": "undb_share_space_id_undb_space_id_fk", + "tableFrom": "undb_share", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_space": { + "name": "undb_space", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_personal": { + "name": "is_personal", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(CURRENT_TIMESTAMP)" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_by": { + "name": "deleted_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "space_name_idx": { + "name": "space_name_idx", + "columns": [ + "name" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_space_created_by_undb_user_id_fk": { + "name": "undb_space_created_by_undb_user_id_fk", + "tableFrom": "undb_space", + "tableTo": "undb_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_space_updated_by_undb_user_id_fk": { + "name": "undb_space_updated_by_undb_user_id_fk", + "tableFrom": "undb_space", + "tableTo": "undb_user", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_space_deleted_by_undb_user_id_fk": { + "name": "undb_space_deleted_by_undb_user_id_fk", + "tableFrom": "undb_space", + "tableTo": "undb_user", + "columnsFrom": [ + "deleted_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_space_member": { + "name": "undb_space_member", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "space_member_unique_idx": { + "name": "space_member_unique_idx", + "columns": [ + "user_id", + "space_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_space_member_user_id_undb_user_id_fk": { + "name": "undb_space_member_user_id_undb_user_id_fk", + "tableFrom": "undb_space_member", + "tableTo": "undb_user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_space_member_space_id_undb_space_id_fk": { + "name": "undb_space_member_space_id_undb_space_id_fk", + "tableFrom": "undb_space_member", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_table_id_mapping": { + "name": "undb_table_id_mapping", + "columns": { + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "subject_id": { + "name": "subject_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "undb_table_id_mapping_table_id_undb_table_id_fk": { + "name": "undb_table_id_mapping_table_id_undb_table_id_fk", + "tableFrom": "undb_table_id_mapping", + "tableTo": "undb_table", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "undb_table_id_mapping_table_id_subject_id_pk": { + "columns": [ + "table_id", + "subject_id" + ], + "name": "undb_table_id_mapping_table_id_subject_id_pk" + } + }, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_table": { + "name": "undb_table", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "base_id": { + "name": "base_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schema": { + "name": "schema", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "views": { + "name": "views", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "forms": { + "name": "forms", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rls": { + "name": "rls", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "widgets": { + "name": "widgets", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(CURRENT_TIMESTAMP)" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "table_base_id_idx": { + "name": "table_base_id_idx", + "columns": [ + "base_id" + ], + "isUnique": false + }, + "table_space_id_idx": { + "name": "table_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "table_name_unique_idx": { + "name": "table_name_unique_idx", + "columns": [ + "name", + "base_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "undb_table_base_id_undb_base_id_fk": { + "name": "undb_table_base_id_undb_base_id_fk", + "tableFrom": "undb_table", + "tableTo": "undb_base", + "columnsFrom": [ + "base_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_table_space_id_undb_space_id_fk": { + "name": "undb_table_space_id_undb_space_id_fk", + "tableFrom": "undb_table", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_table_created_by_undb_user_id_fk": { + "name": "undb_table_created_by_undb_user_id_fk", + "tableFrom": "undb_table", + "tableTo": "undb_user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_table_updated_by_undb_user_id_fk": { + "name": "undb_table_updated_by_undb_user_id_fk", + "tableFrom": "undb_table", + "tableTo": "undb_user", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_user": { + "name": "undb_user", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_verified": { + "name": "email_verified", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "undb_user_email_unique": { + "name": "undb_user_email_unique", + "columns": [ + "email" + ], + "isUnique": true + }, + "user_username_idx": { + "name": "user_username_idx", + "columns": [ + "username" + ], + "isUnique": false + }, + "user_email_idx": { + "name": "user_email_idx", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "undb_webhook": { + "name": "undb_webhook", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "table_id": { + "name": "table_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headers": { + "name": "headers", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "condition": { + "name": "condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event": { + "name": "event", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "space_id": { + "name": "space_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "webhook_table_id_idx": { + "name": "webhook_table_id_idx", + "columns": [ + "table_id" + ], + "isUnique": false + }, + "webhook_space_id_idx": { + "name": "webhook_space_id_idx", + "columns": [ + "space_id" + ], + "isUnique": false + }, + "webhook_url_idx": { + "name": "webhook_url_idx", + "columns": [ + "url" + ], + "isUnique": false + } + }, + "foreignKeys": { + "undb_webhook_table_id_undb_table_id_fk": { + "name": "undb_webhook_table_id_undb_table_id_fk", + "tableFrom": "undb_webhook", + "tableTo": "undb_table", + "columnsFrom": [ + "table_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "undb_webhook_space_id_undb_space_id_fk": { + "name": "undb_webhook_space_id_undb_space_id_fk", + "tableFrom": "undb_webhook", + "tableTo": "undb_space", + "columnsFrom": [ + "space_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/apps/backend/drizzle/meta/_journal.json b/apps/backend/drizzle/meta/_journal.json index c118d7e6a..9966a026f 100644 --- a/apps/backend/drizzle/meta/_journal.json +++ b/apps/backend/drizzle/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1729559227374, "tag": "0012_lying_tomorrow_man", "breakpoints": true + }, + { + "idx": 13, + "version": "6", + "when": 1730979840099, + "tag": "0013_lovely_mordo", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date-record.svelte b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date-record.svelte index 3e525bb7d..88f994679 100644 --- a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date-record.svelte +++ b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date-record.svelte @@ -4,6 +4,7 @@ import type { Field, RecordDO, DateField, DateRangeField } from "@undb/table" import { monthStore } from "$lib/store/calendar.store" import { cn } from "$lib/utils" + import { getTable } from "$lib/store/table.store" export let record: RecordDO export let displayField: Field | undefined @@ -13,6 +14,8 @@ export let readonly = false export let shareId: string | undefined + const table = getTable() + function setupDraggableDate(node: HTMLElement, record: RecordDO) { function setup(record: RecordDO) { if (readonly || shareId) return @@ -42,7 +45,9 @@ } } - $: displayValue = displayField ? (record.getValue(displayField.id).into(undefined)?.value ?? "") : "" + $: displayValue = displayField + ? record.getValue(displayField.id).into(undefined)?.value || record.getDisplayValue($table) + : "" $: value = record.getValue(field.id).into(undefined)?.value ? field.format(record.getValue(field.id).into(undefined)?.value ?? "") : "" diff --git a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date.svelte b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date.svelte index f153c82b4..8ee03b404 100644 --- a/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date.svelte +++ b/apps/frontend/src/lib/components/blocks/calendar-view/calendar-view-month-date.svelte @@ -28,9 +28,9 @@ const isSelected = monthStore.isSelected const getIsSameMonth = monthStore.getIsSameMonth - let day = getDate(date) - let today = isToday(date) - let _isWeekend = isWeekend(date) + $: day = getDate(date) + $: today = isToday(date) + $: _isWeekend = isWeekend(date) $: selected = $isSelected(date) $: isSameMonth = $getIsSameMonth(date) @@ -202,7 +202,7 @@ {date} {r} readonly={true} - shareId={shareId} + {shareId} record={aboutToDropRecord} {displayField} {field} diff --git a/apps/frontend/src/lib/components/blocks/template/template-preview.svelte b/apps/frontend/src/lib/components/blocks/template/template-preview.svelte index 2ef18665e..4054148ff 100644 --- a/apps/frontend/src/lib/components/blocks/template/template-preview.svelte +++ b/apps/frontend/src/lib/components/blocks/template/template-preview.svelte @@ -11,6 +11,8 @@ import { setTemplate } from "$lib/store/template.store" import RecordDetailSheet from "$lib/components/blocks/record-detail/record-detail-sheet.svelte" import GalleryView from "$lib/components/blocks/gallery-view/gallery-view.svelte" + import CalendarView from "$lib/components/blocks/calendar-view/calendar-view.svelte" + import ListView from "$lib/components/blocks/list-view/list-view.svelte" export let template: ITemplateDTO @@ -198,6 +200,10 @@ {:else if $currentView?.type === "gallery"} + {:else if $currentView?.type === "calendar"} + + {:else if $currentView?.type === "list"} + {/if} {/if} diff --git a/package.json b/package.json index 0061d2602..17490152c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "undb", - "version": "1.0.0-114", + "version": "1.0.0-115", "private": true, "scripts": { "build": "NODE_ENV=production bun --bun turbo build", diff --git a/packages/persistence/src/base/base.repository.ts b/packages/persistence/src/base/base.repository.ts index 0795dd3fa..fd82435cc 100644 --- a/packages/persistence/src/base/base.repository.ts +++ b/packages/persistence/src/base/base.repository.ts @@ -132,9 +132,29 @@ export class BaseRepository implements IBaseRepository { .where((eb) => eb.eb("table_id", "in", tableIds)) .execute() + await trx + .deleteFrom("undb_dashboard_table_id_mapping") + .where((eb) => eb.eb("table_id", "in", tableIds)) + .execute() + + await trx + .deleteFrom("undb_attachment_mapping") + .where((eb) => eb.eb("table_id", "in", tableIds)) + .execute() + + await trx + .deleteFrom("undb_webhook") + .where((eb) => eb.eb("table_id", "in", tableIds)) + .execute() + + await trx + .deleteFrom("undb_dashboard") + .where((eb) => eb.eb("base_id", "=", id)) + .execute() + await trx .deleteFrom("undb_table") - .where((eb) => eb.eb("id", "in", tableIds)) + .where((eb) => eb.eb("base_id", "=", id)) .execute() await trx diff --git a/packages/persistence/src/table/table.repository.ts b/packages/persistence/src/table/table.repository.ts index 31c3cd860..492685e8f 100644 --- a/packages/persistence/src/table/table.repository.ts +++ b/packages/persistence/src/table/table.repository.ts @@ -244,6 +244,21 @@ export class TableRepository implements ITableRepository { .where((eb) => eb.or([eb.eb("table_id", "=", table.id.value), eb.eb("foreign_table_id", "=", table.id.value)])) .execute() + await trx + .deleteFrom("undb_dashboard_table_id_mapping") + .where((eb) => eb.eb("table_id", "=", table.id.value)) + .execute() + + await trx + .deleteFrom("undb_attachment_mapping") + .where((eb) => eb.eb("table_id", "=", table.id.value)) + .execute() + + await trx + .deleteFrom("undb_webhook") + .where((eb) => eb.eb("table_id", "=", table.id.value)) + .execute() + await trx .deleteFrom("undb_table") .where((eb) => eb.eb("id", "=", table.id.value)) diff --git a/packages/persistence/src/tables.ts b/packages/persistence/src/tables.ts index f0f6ca525..1de4926d0 100644 --- a/packages/persistence/src/tables.ts +++ b/packages/persistence/src/tables.ts @@ -97,13 +97,9 @@ export const referenceIdMapping = sqliteTable( "reference_id_mapping", { fieldId: text("field_id").notNull(), - tableId: text("table_id") - .notNull() - .references(() => tables.id), + tableId: text("table_id").notNull(), symmetricFieldId: text("symmetric_field_id"), - foreignTableId: text("foreign_table_id") - .notNull() - .references(() => tables.id), + foreignTableId: text("foreign_table_id").notNull(), }, (table) => { return { @@ -121,13 +117,9 @@ export const rollupIdMapping = sqliteTable( "rollup_id_mapping", { fieldId: text("field_id").notNull(), - tableId: text("table_id") - .notNull() - .references(() => tables.id), + tableId: text("table_id").notNull(), rollupId: text("rollup_id").notNull(), - rollupTableId: text("rollup_table_id") - .notNull() - .references(() => tables.id), + rollupTableId: text("rollup_table_id").notNull(), }, (table) => { return { diff --git a/packages/persistence/src/underlying/underlying-table-field.visitor.ts b/packages/persistence/src/underlying/underlying-table-field.visitor.ts index 0b88ca332..d8bfbd72b 100644 --- a/packages/persistence/src/underlying/underlying-table-field.visitor.ts +++ b/packages/persistence/src/underlying/underlying-table-field.visitor.ts @@ -30,10 +30,8 @@ import { } from "@undb/table" import type { CurrencyField } from "@undb/table/src/modules/schema/fields/variants/currency-field" import type { EmailField } from "@undb/table/src/modules/schema/fields/variants/email-field" -import { getTableName } from "drizzle-orm" import { AlterTableBuilder, AlterTableColumnAlteringBuilder, CompiledQuery, CreateTableBuilder, sql } from "kysely" import type { IQueryBuilder } from "../qb" -import { users } from "../tables" import { JoinTable } from "./reference/join-table" import { getUnderlyingFormulaType } from "./underlying-formula.util" import { UnderlyingFormulaVisitor } from "./underlying-formula.visitor" @@ -168,12 +166,8 @@ export class UnderlyingTableFieldVisitor const sql = this.qb.schema .createTable(joinTable.getTableName()) .ifNotExists() - .addColumn(joinTable.getSymmetricValueFieldId(), "varchar(10)", (b) => - b.references(`${field.foreignTableId}.${ID_TYPE}`).notNull().onDelete("cascade"), - ) - .addColumn(joinTable.getValueFieldId(), "varchar(10)", (b) => - b.references(`${this.t.table.id.value}.${ID_TYPE}`).notNull().onDelete("cascade"), - ) + .addColumn(joinTable.getSymmetricValueFieldId(), "varchar(10)", (b) => b.notNull()) + .addColumn(joinTable.getValueFieldId(), "varchar(10)", (b) => b.notNull()) .addPrimaryKeyConstraint("primary_key", [joinTable.getSymmetricValueFieldId(), joinTable.getValueFieldId()]) .compile() this.addSql(sql) @@ -189,10 +183,7 @@ export class UnderlyingTableFieldVisitor } user(field: UserField): void { if (field.isSingle) { - const user = getTableName(users) - const c = this.tb.addColumn(field.id.value, "text", (b) => - b.references(`${user}.${users.id.name}`).onDelete("restrict"), - ) + const c = this.tb.addColumn(field.id.value, "text") this.addColumn(c) } else { const c = this.tb.addColumn(field.id.value, "json") diff --git a/packages/persistence/src/underlying/underlying-table-spec.visitor.ts b/packages/persistence/src/underlying/underlying-table-spec.visitor.ts index db8a51942..f2eca6499 100644 --- a/packages/persistence/src/underlying/underlying-table-spec.visitor.ts +++ b/packages/persistence/src/underlying/underlying-table-spec.visitor.ts @@ -258,7 +258,7 @@ export class UnderlyingTableSpecVisitor implements ITableSpecVisitor { const field = schema.field if (field.isOwner) { const joinTable = new JoinTable(this.table.table, field) - const query = this.qb.schema.dropTable(joinTable.getTableName()).compile() + const query = this.qb.schema.dropTable(joinTable.getTableName()).ifExists().compile() this.addSql(query) } return diff --git a/packages/persistence/src/underlying/underlying-table.service.ts b/packages/persistence/src/underlying/underlying-table.service.ts index 6cc765cae..02498ea9a 100644 --- a/packages/persistence/src/underlying/underlying-table.service.ts +++ b/packages/persistence/src/underlying/underlying-table.service.ts @@ -49,7 +49,7 @@ export class UnderlyingTableService { async delete(table: TableDo) { const t = new UnderlyingTable(table) const trx = getCurrentTransaction() - await trx.schema.dropTable(t.name).execute() + await trx.schema.dropTable(t.name).ifExists().execute() const referenceFields = table.schema.getReferenceFields() for (const field of referenceFields) { const joinTable = new JoinTable(table, field) diff --git a/packages/table/src/modules/views/view/variants/abstract-view.vo.ts b/packages/table/src/modules/views/view/variants/abstract-view.vo.ts index 4230349f1..c4d733bc5 100644 --- a/packages/table/src/modules/views/view/variants/abstract-view.vo.ts +++ b/packages/table/src/modules/views/view/variants/abstract-view.vo.ts @@ -35,6 +35,13 @@ export const createBaseViewDTO = z.object({ id: viewId.optional(), name: viewName, isDefault: z.boolean().optional(), + + filter: viewFilterGroup.optional(), + color: viewColorGroup.optional(), + sort: viewSort.optional(), + fields: viewFields.optional(), + aggregate: viewAggregate.optional(), + widgets: widgetDTO.array().optional(), }) export type ICreateBaseViewDTO = z.infer diff --git a/packages/table/src/modules/views/view/view-filter/view-filter.vo.ts b/packages/table/src/modules/views/view/view-filter/view-filter.vo.ts index b2b2ae553..34f48ae85 100644 --- a/packages/table/src/modules/views/view/view-filter/view-filter.vo.ts +++ b/packages/table/src/modules/views/view/view-filter/view-filter.vo.ts @@ -8,7 +8,7 @@ import { type IRootCondition, } from "../../../schema/fields/condition" -export const viewFilterOption = z.undefined() +export const viewFilterOption = z.any() export type IViewFilterOptionSchema = typeof viewFilterOption diff --git a/packages/template/src/templates/eventPlaning.base.json b/packages/template/src/templates/eventPlaning.base.json index 2343dde2d..5739c70be 100644 --- a/packages/template/src/templates/eventPlaning.base.json +++ b/packages/template/src/templates/eventPlaning.base.json @@ -5,7 +5,8 @@ "schema": { "Activity": { "id": "activity", - "type": "string" + "type": "string", + "display": true }, "Type": { "id": "type", @@ -133,12 +134,35 @@ } } }, + "views": { + "All Events": { + "type": "grid", + "sort": [ + { + "fieldId": "start", + "direction": "asc" + } + ] + }, + "Calendar View": { + "type": "calendar", + "calendar": { + "field": "start" + } + }, + "By Type": { + "type": "kanban", + "kanban": { + "field": "type" + } + } + }, "records": [ { "Activity": "Welcome breakfast", "Type": "meal", - "Start": "2021-09-01T08:00:00.000Z", - "End": "2021-09-01T09:00:00.000Z", + "Start": "2024-11-01", + "End": "2024-11-01", "Location": "Ballroom A", "Speakers": ["speaker-1", "speaker-2"], "Notes": "Breakfast will be served in the ballroom" @@ -146,8 +170,8 @@ { "Activity": "Opening keynote", "Type": "keynote", - "Start": "2021-09-01T09:30:00.000Z", - "End": "2021-09-01T10:30:00.000Z", + "Start": "2024-11-02", + "End": "2024-11-02", "Location": "Auditorium", "Speakers": ["speaker-1"], "Notes": "Jane will be speaking about the future of technology" @@ -155,8 +179,8 @@ { "Activity": "Panel Discussion: AI Ethics", "Type": "panel", - "Start": "2021-09-01T11:00:00.000Z", - "End": "2021-09-01T12:30:00.000Z", + "Start": "2024-11-03", + "End": "2024-11-03", "Location": "Conference Room B", "Speakers": ["speaker-2", "speaker-3"], "Notes": "Exploring ethical considerations in AI development" @@ -164,8 +188,8 @@ { "Activity": "Networking Lunch", "Type": "meal", - "Start": "2021-09-01T12:30:00.000Z", - "End": "2021-09-01T14:00:00.000Z", + "Start": "2024-11-04", + "End": "2024-11-04", "Location": "Garden Terrace", "Speakers": [], "Notes": "Buffet lunch with vegetarian options available" @@ -173,8 +197,8 @@ { "Activity": "Workshop: Cloud Computing", "Type": "workshop", - "Start": "2021-09-01T14:00:00.000Z", - "End": "2021-09-01T16:00:00.000Z", + "Start": "2024-11-05", + "End": "2024-11-05", "Location": "Tech Lab", "Speakers": ["speaker-1"], "Notes": "Hands-on session on cloud infrastructure" @@ -182,8 +206,8 @@ { "Activity": "Coffee Break", "Type": "break", - "Start": "2021-09-01T16:00:00.000Z", - "End": "2021-09-01T16:30:00.000Z", + "Start": "2024-11-06", + "End": "2024-11-06", "Location": "Lobby", "Speakers": [], "Notes": "Refreshments and light snacks provided" @@ -191,8 +215,8 @@ { "Activity": "Closing Remarks", "Type": "presentation", - "Start": "2021-09-01T16:30:00.000Z", - "End": "2021-09-01T17:00:00.000Z", + "Start": "2024-11-07", + "End": "2024-11-07", "Location": "Auditorium", "Speakers": ["speaker-2"], "Notes": "Summary of the day's events and future outlook" @@ -200,8 +224,8 @@ { "Activity": "VR Demo", "Type": "demo", - "Start": "2021-09-02T09:00:00.000Z", - "End": "2021-09-02T11:00:00.000Z", + "Start": "2024-11-08", + "End": "2024-11-08", "Location": "Innovation Hub", "Speakers": ["speaker-3"], "Notes": "Showcasing latest VR technologies" @@ -209,8 +233,8 @@ { "Activity": "Blockchain Seminar", "Type": "seminar", - "Start": "2021-09-02T11:30:00.000Z", - "End": "2021-09-02T13:00:00.000Z", + "Start": "2024-11-09", + "End": "2024-11-09", "Location": "Conference Room A", "Speakers": ["speaker-1", "speaker-2"], "Notes": "Exploring blockchain applications in various industries" @@ -218,8 +242,8 @@ { "Activity": "Startup Pitch Competition", "Type": "competition", - "Start": "2021-09-02T14:00:00.000Z", - "End": "2021-09-02T16:00:00.000Z", + "Start": "2024-11-10", + "End": "2024-11-10", "Location": "Auditorium", "Speakers": [], "Notes": "10 startups competing for funding" @@ -227,8 +251,8 @@ { "Activity": "Gala Dinner", "Type": "meal", - "Start": "2021-09-02T19:00:00.000Z", - "End": "2021-09-02T22:00:00.000Z", + "Start": "2024-11-11", + "End": "2024-11-11", "Location": "Grand Ballroom", "Speakers": [], "Notes": "Formal attire required, awards ceremony included" @@ -236,8 +260,8 @@ { "Activity": "IoT Workshop", "Type": "workshop", - "Start": "2021-09-03T09:00:00.000Z", - "End": "2021-09-03T11:00:00.000Z", + "Start": "2024-11-12", + "End": "2024-11-12", "Location": "Tech Lab", "Speakers": ["speaker-3"], "Notes": "Practical session on IoT device programming" @@ -245,8 +269,8 @@ { "Activity": "Future of Work Panel", "Type": "panel", - "Start": "2021-09-03T11:30:00.000Z", - "End": "2021-09-03T13:00:00.000Z", + "Start": "2024-11-13", + "End": "2024-11-13", "Location": "Conference Room B", "Speakers": ["speaker-1", "speaker-2", "speaker-3"], "Notes": "Discussing remote work trends and technologies" @@ -254,8 +278,8 @@ { "Activity": "Networking Lunch", "Type": "meal", - "Start": "2021-09-03T13:00:00.000Z", - "End": "2021-09-03T14:30:00.000Z", + "Start": "2024-11-14", + "End": "2024-11-14", "Location": "Rooftop Garden", "Speakers": [], "Notes": "Casual lunch with scenic views" @@ -263,8 +287,8 @@ { "Activity": "Cybersecurity Masterclass", "Type": "workshop", - "Start": "2021-09-03T15:00:00.000Z", - "End": "2021-09-03T17:00:00.000Z", + "Start": "2024-11-15", + "End": "2024-11-15", "Location": "Secure Lab", "Speakers": ["speaker-2"], "Notes": "Advanced techniques in network security" @@ -272,8 +296,8 @@ { "Activity": "Closing Keynote", "Type": "keynote", - "Start": "2021-09-03T17:30:00.000Z", - "End": "2021-09-03T18:30:00.000Z", + "Start": "2024-11-16", + "End": "2024-11-16", "Location": "Auditorium", "Speakers": ["speaker-1"], "Notes": "Inspirational talk on innovation and future tech" @@ -281,8 +305,8 @@ { "Activity": "Farewell Cocktail Reception", "Type": "networking", - "Start": "2021-09-03T19:00:00.000Z", - "End": "2021-09-03T21:00:00.000Z", + "Start": "2024-11-17", + "End": "2024-11-17", "Location": "Skyline Lounge", "Speakers": [], "Notes": "Casual networking event with drinks and canapés" @@ -290,8 +314,8 @@ { "Activity": "AI in Healthcare Symposium", "Type": "symposium", - "Start": "2021-09-04T09:00:00.000Z", - "End": "2021-09-04T12:00:00.000Z", + "Start": "2024-11-18", + "End": "2024-11-18", "Location": "Medical Tech Center", "Speakers": ["speaker-1", "speaker-3"], "Notes": "Exploring AI applications in medical diagnosis and treatment" @@ -299,8 +323,8 @@ { "Activity": "Green Tech Showcase", "Type": "exhibition", - "Start": "2021-09-04T13:00:00.000Z", - "End": "2021-09-04T16:00:00.000Z", + "Start": "2024-11-19", + "End": "2024-11-19", "Location": "Exhibition Hall", "Speakers": [], "Notes": "Displaying latest innovations in sustainable technology" @@ -308,8 +332,8 @@ { "Activity": "Quantum Computing Talk", "Type": "presentation", - "Start": "2021-09-04T16:30:00.000Z", - "End": "2021-09-04T17:30:00.000Z", + "Start": "2024-11-20", + "End": "2024-11-20", "Location": "Lecture Hall", "Speakers": ["speaker-2"], "Notes": "Introduction to quantum computing principles and applications" @@ -317,8 +341,8 @@ { "Activity": "Tech Trivia Night", "Type": "social", - "Start": "2021-09-04T20:00:00.000Z", - "End": "2021-09-04T22:00:00.000Z", + "Start": "2024-11-21", + "End": "2024-11-21", "Location": "Hotel Bar", "Speakers": [], "Notes": "Fun quiz night with tech-themed questions and prizes" @@ -326,8 +350,8 @@ { "Activity": "Robotics Demonstration", "Type": "demo", - "Start": "2021-09-05T10:00:00.000Z", - "End": "2021-09-05T12:00:00.000Z", + "Start": "2024-11-22", + "End": "2024-11-22", "Location": "Robotics Lab", "Speakers": ["speaker-3"], "Notes": "Live demonstration of advanced robotics systems" @@ -335,8 +359,8 @@ { "Activity": "Women in Tech Luncheon", "Type": "networking", - "Start": "2021-09-05T12:30:00.000Z", - "End": "2021-09-05T14:00:00.000Z", + "Start": "2024-11-23", + "End": "2024-11-23", "Location": "Executive Dining Room", "Speakers": ["speaker-1"], "Notes": "Celebrating and supporting women in technology fields" @@ -344,8 +368,8 @@ { "Activity": "5G and Beyond Panel", "Type": "panel", - "Start": "2021-09-05T14:30:00.000Z", - "End": "2021-09-05T16:00:00.000Z", + "Start": "2024-11-24", + "End": "2024-11-24", "Location": "Conference Room A", "Speakers": ["speaker-2", "speaker-3"], "Notes": "Discussing the future of mobile networks and connectivity" @@ -353,8 +377,8 @@ { "Activity": "Augmented Reality Workshop", "Type": "workshop", - "Start": "2021-09-05T16:30:00.000Z", - "End": "2021-09-05T18:30:00.000Z", + "Start": "2024-11-25", + "End": "2024-11-25", "Location": "AR/VR Studio", "Speakers": ["speaker-1"], "Notes": "Hands-on session creating AR applications" @@ -362,8 +386,8 @@ { "Activity": "Tech Ethics Roundtable", "Type": "discussion", - "Start": "2021-09-06T09:00:00.000Z", - "End": "2021-09-06T11:00:00.000Z", + "Start": "2024-11-26", + "End": "2024-11-26", "Location": "Boardroom", "Speakers": ["speaker-1", "speaker-2", "speaker-3"], "Notes": "Open discussion on ethical challenges in technology" @@ -371,8 +395,8 @@ { "Activity": "Data Science Bootcamp", "Type": "workshop", - "Start": "2021-09-06T11:30:00.000Z", - "End": "2021-09-06T15:30:00.000Z", + "Start": "2024-11-27", + "End": "2024-11-27", "Location": "Computer Lab", "Speakers": ["speaker-2"], "Notes": "Intensive session on data analysis and machine learning" @@ -380,8 +404,8 @@ { "Activity": "Tech Startup Mentoring", "Type": "mentoring", - "Start": "2021-09-06T16:00:00.000Z", - "End": "2021-09-06T18:00:00.000Z", + "Start": "2024-11-28", + "End": "2024-11-28", "Location": "Meeting Rooms", "Speakers": ["speaker-1", "speaker-3"], "Notes": "One-on-one mentoring sessions for tech entrepreneurs" @@ -389,8 +413,8 @@ { "Activity": "Cybersecurity CTF Competition", "Type": "competition", - "Start": "2021-09-07T09:00:00.000Z", - "End": "2021-09-07T17:00:00.000Z", + "Start": "2024-11-29", + "End": "2024-11-29", "Location": "Secure Lab", "Speakers": [], "Notes": "Capture The Flag competition for security enthusiasts" @@ -398,8 +422,8 @@ { "Activity": "Future of Transportation Symposium", "Type": "symposium", - "Start": "2021-09-07T10:00:00.000Z", - "End": "2021-09-07T13:00:00.000Z", + "Start": "2024-11-30", + "End": "2024-11-30", "Location": "Auditorium", "Speakers": ["speaker-1", "speaker-2"], "Notes": "Exploring electric vehicles, autonomous driving, and urban mobility" @@ -407,8 +431,8 @@ { "Activity": "Open Source Contributors Meetup", "Type": "networking", - "Start": "2021-09-07T14:00:00.000Z", - "End": "2021-09-07T16:00:00.000Z", + "Start": "2024-12-01", + "End": "2024-12-01", "Location": "Collaboration Space", "Speakers": [], "Notes": "Casual meetup for open source project contributors" @@ -416,8 +440,8 @@ { "Activity": "Tech Job Fair", "Type": "career", - "Start": "2021-09-08T10:00:00.000Z", - "End": "2021-09-08T16:00:00.000Z", + "Start": "2024-12-02", + "End": "2024-12-02", "Location": "Exhibition Hall", "Speakers": [], "Notes": "Connect with tech companies and explore job opportunities" @@ -425,8 +449,8 @@ { "Activity": "Closing Ceremony", "Type": "ceremony", - "Start": "2021-09-08T17:00:00.000Z", - "End": "2021-09-08T18:00:00.000Z", + "Start": "2024-12-03", + "End": "2024-12-03", "Location": "Grand Ballroom", "Speakers": ["speaker-1", "speaker-2", "speaker-3"], "Notes": "Wrapping up the event with final remarks and awards" @@ -437,7 +461,8 @@ "schema": { "Name": { "id": "name", - "type": "string" + "type": "string", + "display": true }, "Company": { "id": "company", diff --git a/packages/template/src/templates/hr.base.json b/packages/template/src/templates/hr.base.json index 711a7fc5c..44f206463 100644 --- a/packages/template/src/templates/hr.base.json +++ b/packages/template/src/templates/hr.base.json @@ -359,6 +359,28 @@ "email": "liam@example.com", "employment_status": "full_time", "phone": "234-567-8902" + }, + { + "id": "EMP013", + "name": "Michael Zhang", + "position": "developer", + "department": ["dept1"], + "start_date": "2023-05-15", + "salary": 74000, + "email": "michael@example.com", + "employment_status": "full_time", + "phone": "345-678-9013" + }, + { + "id": "EMP014", + "name": "Sarah Chen", + "position": "designer", + "department": ["dept3"], + "start_date": "2023-06-01", + "salary": 66000, + "email": "sarah@example.com", + "employment_status": "full_time", + "phone": "456-789-0124" } ] }, @@ -581,7 +603,7 @@ "records": [ { "employee": ["EMP001"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 7000, "bonus": 500, "deductions": 1000, @@ -589,7 +611,7 @@ }, { "employee": ["EMP002"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 9000, "bonus": 1000, "deductions": 1500, @@ -597,7 +619,7 @@ }, { "employee": ["EMP003"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 6000, "bonus": 300, "deductions": 800, @@ -605,7 +627,7 @@ }, { "employee": ["EMP004"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 7500, "bonus": 600, "deductions": 1100, @@ -613,7 +635,7 @@ }, { "employee": ["EMP005"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 6500, "bonus": 400, "deductions": 900, @@ -621,7 +643,7 @@ }, { "employee": ["EMP006"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 6800, "bonus": 450, "deductions": 950, @@ -629,7 +651,7 @@ }, { "employee": ["EMP007"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 7200, "bonus": 550, "deductions": 1050, @@ -637,7 +659,7 @@ }, { "employee": ["EMP008"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 7100, "bonus": 520, "deductions": 1020, @@ -645,7 +667,7 @@ }, { "employee": ["EMP009"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 6200, "bonus": 320, "deductions": 820, @@ -653,7 +675,7 @@ }, { "employee": ["EMP010"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 9200, "bonus": 1100, "deductions": 1600, @@ -661,7 +683,7 @@ }, { "employee": ["EMP011"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 6700, "bonus": 420, "deductions": 920, @@ -669,7 +691,7 @@ }, { "employee": ["EMP012"], - "month": "2023-08-01", + "month": "2024-03-01", "amount": 7300, "bonus": 570, "deductions": 1070, @@ -825,80 +847,80 @@ "records": [ { "employee": ["EMP001"], - "start_date": "2023-09-01", - "end_date": "2023-09-10", + "start_date": "2024-03-01", + "end_date": "2024-03-10", "type": "vacation", "status": "approved", "reason": "Annual family vacation" }, { "employee": ["EMP002"], - "start_date": "2023-10-15", - "end_date": "2023-10-20", + "start_date": "2024-03-15", + "end_date": "2024-03-20", "type": "personal", "status": "pending", "reason": "Personal matters" }, { "employee": ["EMP003"], - "start_date": "2023-11-05", - "end_date": "2023-11-15", + "start_date": "2024-03-05", + "end_date": "2024-03-15", "type": "sick", "status": "approved", "reason": "Recovering from surgery" }, { "employee": ["EMP004"], - "start_date": "2023-12-20", - "end_date": "2023-12-31", + "start_date": "2024-03-20", + "end_date": "2024-03-31", "type": "vacation", "status": "approved", "reason": "Holiday break" }, { "employee": ["EMP005"], - "start_date": "2023-09-25", - "end_date": "2023-09-26", + "start_date": "2024-03-25", + "end_date": "2024-03-26", "type": "personal", "status": "approved", "reason": "Attending a wedding" }, { "employee": ["EMP006"], - "start_date": "2023-10-05", - "end_date": "2023-10-07", + "start_date": "2024-03-05", + "end_date": "2024-03-07", "type": "sick", "status": "approved", "reason": "Flu" }, { "employee": ["EMP007"], - "start_date": "2023-11-20", - "end_date": "2023-11-24", + "start_date": "2024-03-20", + "end_date": "2024-03-24", "type": "vacation", "status": "pending", "reason": "Thanksgiving break" }, { "employee": ["EMP008"], - "start_date": "2023-12-01", - "end_date": "2023-12-02", + "start_date": "2024-03-01", + "end_date": "2024-03-02", "type": "personal", "status": "approved", "reason": "Moving to a new apartment" }, { "employee": ["EMP009"], - "start_date": "2023-09-15", - "end_date": "2023-09-16", + "start_date": "2024-03-15", + "end_date": "2024-03-16", "type": "sick", "status": "approved", "reason": "Dental procedure" }, { "employee": ["EMP010"], - "start_date": "2023-10-10", - "end_date": "2023-10-14", + "start_date": "2024-03-10", + "end_date": "2024-03-14", "type": "vacation", "status": "approved", "reason": "Family reunion" @@ -992,78 +1014,102 @@ "direction": "desc" } ] + }, + "Calendar": { + "type": "calendar", + "calendar": { + "field": "review_date" + } } }, "records": [ { "employee": ["EMP001"], - "review_date": "2023-06-15", + "review_date": "2024-11-15", "reviewer": ["EMP002"], "performance_rating": 4, "comments": "Excellent work on the latest project.", "goals": "Improve leadership skills", - "next_review_date": "2023-12-15" + "next_review_date": "2024-09-15" }, { "employee": ["EMP002"], - "review_date": "2023-07-01", + "review_date": "2024-11-01", "reviewer": ["EMP003"], "performance_rating": 5, "comments": "Outstanding leadership and project management.", "goals": "Mentor junior team members", - "next_review_date": "2024-01-01" + "next_review_date": "2024-09-01" }, { "employee": ["EMP003"], - "review_date": "2023-06-20", + "review_date": "2024-11-20", "reviewer": ["EMP010"], "performance_rating": 4, "comments": "Excellent HR initiatives implemented.", "goals": "Develop new employee onboarding program", - "next_review_date": "2023-12-20" + "next_review_date": "2024-09-20" }, { "employee": ["EMP004"], - "review_date": "2023-07-10", + "review_date": "2024-11-10", "reviewer": ["EMP002"], "performance_rating": 3, "comments": "Good technical skills, needs improvement in communication.", "goals": "Enhance communication with team members", - "next_review_date": "2024-01-10" + "next_review_date": "2024-09-10" }, { "employee": ["EMP005"], - "review_date": "2023-06-25", + "review_date": "2024-11-25", "reviewer": ["EMP010"], "performance_rating": 4, "comments": "Creative designs, meets deadlines consistently.", "goals": "Explore new design tools and techniques", - "next_review_date": "2023-12-25" + "next_review_date": "2024-09-25" }, { "employee": ["EMP006"], - "review_date": "2023-07-05", + "review_date": "2024-11-05", "reviewer": ["EMP003"], "performance_rating": 4, "comments": "Effective marketing campaigns, good team player.", "goals": "Develop skills in digital marketing", - "next_review_date": "2024-01-05" + "next_review_date": "2024-09-05" }, { "employee": ["EMP007"], - "review_date": "2023-06-30", + "review_date": "2024-11-30", "reviewer": ["EMP010"], "performance_rating": 5, "comments": "Exceptional financial analysis and reporting.", "goals": "Lead a cost-saving initiative", - "next_review_date": "2023-12-30" + "next_review_date": "2024-09-30" }, { "employee": ["EMP008"], - "review_date": "2023-07-15", + "review_date": "2024-11-15", "reviewer": ["EMP002"], "performance_rating": 4, "comments": "Strong problem-solving skills, reliable team member." + }, + { + "employee": ["EMP013"], + "review_date": "2024-11-18", + "reviewer": ["EMP002"], + "performance_rating": 4, + "comments": "Excellent coding practices and team collaboration.", + "goals": "Learn new frontend frameworks", + "next_review_date": "2024-09-18" + }, + { + "employee": ["EMP014"], + "review_date": "2024-11-20", + "reviewer": ["EMP010"], + "performance_rating": 5, + "comments": "Outstanding UI/UX designs and user research.", + "goals": "Lead design system implementation", + "next_review_date": "2024-09-20" } ] } diff --git a/packages/trpc/src/trpc.ts b/packages/trpc/src/trpc.ts index 6d55bb6ba..969f294de 100644 --- a/packages/trpc/src/trpc.ts +++ b/packages/trpc/src/trpc.ts @@ -56,7 +56,9 @@ export const p = t.procedure .setIsolationLevel("read committed") .execute(async (tx) => { startTransaction(tx) - return await ctx.next() + const result = await ctx.next() + + return result }) } else { return await ctx.next()