From b19b4bc734aaa20a2eeafbe69c8908095049606f Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 09:07:41 +0800 Subject: [PATCH 01/16] fix: fix import table after create new base --- .../src/lib/components/blocks/import-table/import-table.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte b/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte index 39fe41cd8..77c736811 100644 --- a/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte +++ b/apps/frontend/src/lib/components/blocks/import-table/import-table.svelte @@ -183,7 +183,7 @@ if (step === 1) { if (!file || !data) return - const baseId = $currentBase?.id + const baseId = $currentBase?.id ?? $baseId if (!baseId) return $createTable.mutate({ From ac654e96ace0dde0421958113aa7e607d0ed1f5e Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 10:04:24 +0800 Subject: [PATCH 02/16] feat: foreign table rollup date format --- .../blocks/field-value/rollup-field.svelte | 2 +- .../editable-cell/rollup-cell.svelte | 8 +- .../components/blocks/nav/nav-tools.svelte | 4 +- .../persistence/src/record/record-utils.ts | 40 +- .../src/record/record.query-repository.ts | 4 +- .../src/record/record.repository.ts | 8 +- .../variants/rollup-field/rollup-field.vo.ts | 16 +- .../src/templates/projectManagement.base.json | 1476 ++++++++++++++++- 8 files changed, 1530 insertions(+), 28 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte b/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte index 22486bf58..e2192a8c4 100644 --- a/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte +++ b/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte @@ -30,7 +30,7 @@ {/each} {:else if isNumber(value)} - + {value} {/if} diff --git a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/rollup-cell.svelte b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/rollup-cell.svelte index 49608d162..133f926a1 100644 --- a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/rollup-cell.svelte +++ b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/rollup-cell.svelte @@ -22,13 +22,13 @@ {#each value as item} {#if !!item} {item} {:else} Unamed @@ -54,13 +54,13 @@ {#each value as item} {#if !!item} {item} {:else} Unamed diff --git a/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte b/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte index 9cd2cbc24..8bb918646 100644 --- a/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte +++ b/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte @@ -83,7 +83,7 @@ Create New Base - + {/if} diff --git a/packages/persistence/src/record/record-utils.ts b/packages/persistence/src/record/record-utils.ts index 780653c1b..0740d285c 100644 --- a/packages/persistence/src/record/record-utils.ts +++ b/packages/persistence/src/record/record-utils.ts @@ -8,8 +8,11 @@ import { type IRecordValues, type TableDo, } from "@undb/table" +import { format } from "date-fns/fp" import { isNumber, isString } from "radash" +const formatter = format("yyyy-MM-dd") + export type DisplayFieldName = `$${string}` /** @@ -56,7 +59,7 @@ const logger = createLogger("record-utils") * @param entity The entity to get the record DTO from. * @returns The record DTO. */ -export function getRecordDTOFromEntity(table: TableDo, entity: any): IRecordDTO { +export function getRecordDTOFromEntity(table: TableDo, entity: any, foreignTables: Map): IRecordDTO { const id = entity.id const values: IRecordValues = {} const displayValues: IRecordDisplayValues = {} @@ -104,7 +107,6 @@ export function getRecordDTOFromEntity(table: TableDo, entity: any): IRecordDTO if ( (field.type === "reference" || - (field.type === "rollup" && field.fn === "lookup") || field.type === "attachment" || field.type === "json" || ((field.type === "select" || field.type === "user") && field.isMultiple)) && @@ -119,6 +121,40 @@ export function getRecordDTOFromEntity(table: TableDo, entity: any): IRecordDTO continue } + if (field.type === "rollup" && field.fn === "lookup") { + const foreignTable = field.getForeignTable(table, foreignTables) + let isLookupDate = false + if (foreignTable) { + const rollupField = field.getRollupField(foreignTable) + if (rollupField.isSome()) { + const type = rollupField.unwrap().type + if (type === "date") { + isLookupDate = true + } + } + } + + if (Array.isArray(value)) { + if (isLookupDate) { + values[key] = value.map((v: string | number) => new Date(v).toISOString()).map(formatter) + } else { + values[key] = value + } + continue + } else if (isString(value)) { + try { + values[key] = JSON.parse(value) + if (isLookupDate) { + values[key] = values[key].map((v: string) => new Date(v).toISOString()) + } + } catch (error) { + logger.warn({ error, value }, "Error parsing JSON") + values[key] = [value] + } + continue + } + } + if (field.type === "checkbox") { values[key] = Boolean(value) continue diff --git a/packages/persistence/src/record/record.query-repository.ts b/packages/persistence/src/record/record.query-repository.ts index d42f187eb..512c360a5 100644 --- a/packages/persistence/src/record/record.query-repository.ts +++ b/packages/persistence/src/record/record.query-repository.ts @@ -92,7 +92,7 @@ export class RecordQueryRepository implements IRecordQueryRepository { const result = await qb.where(`${table.id.value}.${ID_TYPE}`, "=", id.value).executeTakeFirst() - return result ? Some(getRecordDTOFromEntity(table, result)) : None + return result ? Some(getRecordDTOFromEntity(table, result, foreignTables)) : None } async find(table: TableDo, view: View, query: Option): Promise> { @@ -122,7 +122,7 @@ export class RecordQueryRepository implements IRecordQueryRepository { const total = await this.countWhere(table, Some({ filter: spec })) - const records = result.map((r) => getRecordDTOFromEntity(table, r)) + const records = result.map((r) => getRecordDTOFromEntity(table, r, foreignTables)) return { values: records, total: Number(total) } } diff --git a/packages/persistence/src/record/record.repository.ts b/packages/persistence/src/record/record.repository.ts index 7a7d5a6f1..5f0d1b512 100644 --- a/packages/persistence/src/record/record.repository.ts +++ b/packages/persistence/src/record/record.repository.ts @@ -150,7 +150,7 @@ export class RecordRepository implements IRecordRepository { const qb = this.helper.createQuery(table, foreignTables, table.schema.fields, spec) const record = await qb.limit(1).executeTakeFirst() - const dto = record ? getRecordDTOFromEntity(table, record) : undefined + const dto = record ? getRecordDTOFromEntity(table, record, foreignTables) : undefined return dto ? Some(RecordDO.fromJSON(table, dto)) : None } @@ -160,7 +160,7 @@ export class RecordRepository implements IRecordRepository { const records = await qb.where(this.helper.handleWhere(table, spec)).execute() return records.map((record) => { - const dto = getRecordDTOFromEntity(table, record) + const dto = getRecordDTOFromEntity(table, record, foreignTables) return RecordDO.fromJSON(table, dto) }) } @@ -175,7 +175,7 @@ export class RecordRepository implements IRecordRepository { return None } - const dto = getRecordDTOFromEntity(table, records[0]) + const dto = getRecordDTOFromEntity(table, records[0], foreignTables) return Some(RecordDO.fromJSON(table, dto)) } @@ -193,7 +193,7 @@ export class RecordRepository implements IRecordRepository { .execute() return records.map((record) => { - const dto = getRecordDTOFromEntity(table, record) + const dto = getRecordDTOFromEntity(table, record, foreignTables) return RecordDO.fromJSON(table, dto) }) } diff --git a/packages/table/src/modules/schema/fields/variants/rollup-field/rollup-field.vo.ts b/packages/table/src/modules/schema/fields/variants/rollup-field/rollup-field.vo.ts index e7c9b8e37..d557c2c84 100644 --- a/packages/table/src/modules/schema/fields/variants/rollup-field/rollup-field.vo.ts +++ b/packages/table/src/modules/schema/fields/variants/rollup-field/rollup-field.vo.ts @@ -1,9 +1,10 @@ import { baseNameSchema } from "@undb/base" -import { Option, Some } from "@undb/domain" +import { None, Option, Some } from "@undb/domain" import { z } from "@undb/zod" import { tableName } from "../../../../../table-name.vo" import type { TableDo } from "../../../../../table.do" import { FieldIdVo, fieldId } from "../../field-id.vo" +import type { Field } from "../../field.type" import type { IFieldVisitor } from "../../field.visitor" import { AbstractField, baseFieldDTO, createBaseFieldDTO } from "../abstract-field.vo" import { createAbstractNumberFieldMather } from "../abstractions" @@ -135,6 +136,19 @@ export class RollupField extends AbstractField) { + const referenceField = this.getReferenceField(table) + const foreignTableId = referenceField.foreignTableId + return foreignTables.get(foreignTableId) + } + + getRollupField(foreignTable: TableDo): Option { + if (!this.rollupFieldId) { + return None + } + return foreignTable.schema.getFieldById(new FieldIdVo(this.rollupFieldId)) + } + get fn() { return this.option.mapOr("lookup", (o) => o.fn) } diff --git a/packages/template/src/templates/projectManagement.base.json b/packages/template/src/templates/projectManagement.base.json index 979f682fe..3b639294c 100644 --- a/packages/template/src/templates/projectManagement.base.json +++ b/packages/template/src/templates/projectManagement.base.json @@ -39,7 +39,7 @@ ] } }, - "Projects Count": { + "Bugs Count": { "type": "rollup", "option": { "fn": "count", @@ -49,6 +49,10 @@ }, "rollupFieldId": "title" } + }, + "Due Date": { + "id": "dueDate", + "type": "date" } }, "views": { @@ -71,11 +75,503 @@ "records": [ { "id": "project-1", - "Title": "Project 1" + "Title": "Smart Home System Development", + "Due Date": "2023-12-31" }, { "id": "project-2", - "Title": "Project 2" + "Title": "E-commerce Platform Upgrade", + "Due Date": "2024-03-15" + }, + { + "id": "project-3", + "Title": "Mobile Payment App Optimization", + "Due Date": "2024-02-28" + }, + { + "id": "project-4", + "Title": "AI Customer Service System", + "Due Date": "2024-06-30" + }, + { + "id": "project-5", + "Title": "Cloud Storage Solution", + "Due Date": "2024-04-30" + }, + { + "id": "project-6", + "Title": "Blockchain Supply Chain Management", + "Due Date": "2024-09-15" + }, + { + "id": "project-7", + "Title": "Virtual Reality Education Platform", + "Due Date": "2024-08-31" + }, + { + "id": "project-8", + "Title": "IoT Vehicle Tracking System", + "Due Date": "2024-05-31" + }, + { + "id": "project-9", + "Title": "Big Data Analytics Tool Development", + "Due Date": "2024-07-31" + }, + { + "id": "project-10", + "Title": "Cybersecurity Enhancement", + "Due Date": "2024-03-31" + }, + { + "id": "project-11", + "Title": "Intelligent Medical Diagnosis System", + "Due Date": "2024-11-30" + }, + { + "id": "project-12", + "Title": "Renewable Energy Management Platform", + "Due Date": "2024-10-31" + }, + { + "id": "project-13", + "Title": "Facial Recognition Access Control", + "Due Date": "2024-06-15" + }, + { + "id": "project-14", + "Title": "Smart City Traffic Management", + "Due Date": "2024-09-30" + }, + { + "id": "project-15", + "Title": "Online Education Course Platform", + "Due Date": "2024-07-15" + }, + { + "id": "project-16", + "Title": "Social Media Data Analysis Tool", + "Due Date": "2024-05-15" + }, + { + "id": "project-17", + "Title": "Smart Agriculture Monitoring System", + "Due Date": "2024-08-15" + }, + { + "id": "project-18", + "Title": "Telemedicine Consultation Platform", + "Due Date": "2024-04-15" + }, + { + "id": "project-19", + "Title": "Enterprise Resource Planning System Upgrade", + "Due Date": "2024-10-15" + }, + { + "id": "project-20", + "Title": "Intelligent Warehouse Management Solution", + "Due Date": "2024-06-30" + }, + { + "id": "project-21", + "Title": "Augmented Reality Navigation App", + "Due Date": "2024-09-15" + }, + { + "id": "project-22", + "Title": "Smart Home Voice Control System", + "Due Date": "2024-07-31" + }, + { + "id": "project-23", + "Title": "Blockchain Digital Identity Verification", + "Due Date": "2024-11-15" + }, + { + "id": "project-24", + "Title": "AI Image Recognition System", + "Due Date": "2024-08-31" + }, + { + "id": "project-25", + "Title": "Intelligent Energy Management Platform", + "Due Date": "2024-05-31" + }, + { + "id": "project-26", + "Title": "Machine Learning Predictive Analytics Tool", + "Due Date": "2024-10-31" + }, + { + "id": "project-27", + "Title": "IoT Smart Waste Sorting System", + "Due Date": "2024-07-15" + }, + { + "id": "project-28", + "Title": "Cloud Computing Resource Scheduling Platform", + "Due Date": "2024-09-30" + }, + { + "id": "project-29", + "Title": "Smart Manufacturing Production Line Optimization", + "Due Date": "2024-12-15" + }, + { + "id": "project-30", + "Title": "Network Security Threat Detection System", + "Due Date": "2024-06-15" + }, + { + "id": "project-31", + "Title": "Intelligent Building Energy Management", + "Due Date": "2024-08-15" + }, + { + "id": "project-32", + "Title": "Blockchain Electronic Voting System", + "Due Date": "2024-11-30" + }, + { + "id": "project-33", + "Title": "AI Natural Language Processing Platform", + "Due Date": "2024-07-31" + }, + { + "id": "project-34", + "Title": "Intelligent Traffic Signal Control System", + "Due Date": "2024-10-15" + }, + { + "id": "project-35", + "Title": "Virtual Reality Training Simulator", + "Due Date": "2024-09-15" + }, + { + "id": "project-36", + "Title": "Big Data Customer Behavior Analysis Platform", + "Due Date": "2024-12-31" + }, + { + "id": "project-37", + "Title": "Smart Water Resource Management System", + "Due Date": "2024-08-31" + }, + { + "id": "project-38", + "Title": "Blockchain Digital Copyright Protection", + "Due Date": "2024-11-15" + }, + { + "id": "project-39", + "Title": "AI Recommendation Engine Development", + "Due Date": "2024-10-31" + }, + { + "id": "project-40", + "Title": "Smart Home Security Monitoring System", + "Due Date": "2024-07-15" + }, + { + "id": "project-41", + "Title": "Cloud-Native Application Development Platform", + "Due Date": "2024-09-30" + }, + { + "id": "project-42", + "Title": "IoT Smart Parking Management", + "Due Date": "2024-06-30" + }, + { + "id": "project-43", + "Title": "Robotic Process Automation Tool", + "Due Date": "2024-08-15" + }, + { + "id": "project-44", + "Title": "Intelligent Environmental Monitoring System", + "Due Date": "2024-11-30" + }, + { + "id": "project-45", + "Title": "Blockchain Cross-Border Payment Platform", + "Due Date": "2024-10-15" + }, + { + "id": "project-46", + "Title": "AI Sentiment Analysis System", + "Due Date": "2024-07-31" + }, + { + "id": "project-47", + "Title": "Smart Factory Production Scheduling Platform", + "Due Date": "2024-09-15" + }, + { + "id": "project-48", + "Title": "Augmented Reality Remote Collaboration Tool", + "Due Date": "2024-12-15" + }, + { + "id": "project-49", + "Title": "Big Data Risk Assessment Model", + "Due Date": "2024-11-15" + }, + { + "id": "project-50", + "Title": "Smart Grid Management System", + "Due Date": "2024-08-31" + }, + { + "id": "project-51", + "Title": "Blockchain Traceability Platform Development", + "Due Date": "2024-10-31" + }, + { + "id": "project-52", + "Title": "AI Video Analysis System", + "Due Date": "2024-09-30" + }, + { + "id": "project-53", + "Title": "Smart Home Energy Management Platform", + "Due Date": "2024-07-15" + }, + { + "id": "project-54", + "Title": "Cloud Security Solution", + "Due Date": "2024-11-30" + }, + { + "id": "project-55", + "Title": "IoT Asset Tracking System", + "Due Date": "2024-08-15" + }, + { + "id": "project-56", + "Title": "Machine Learning Anomaly Detection Tool", + "Due Date": "2024-10-15" + }, + { + "id": "project-57", + "Title": "Smart City Waste Management Platform", + "Due Date": "2024-12-31" + }, + { + "id": "project-58", + "Title": "Blockchain Smart Contract Platform", + "Due Date": "2024-09-15" + }, + { + "id": "project-59", + "Title": "AI Medical Image Analysis", + "Due Date": "2024-11-15" + }, + { + "id": "project-60", + "Title": "Intelligent Logistics Delivery System", + "Due Date": "2024-07-31" + }, + { + "id": "project-61", + "Title": "Virtual Reality Social Platform", + "Due Date": "2024-10-31" + }, + { + "id": "project-62", + "Title": "Big Data Predictive Maintenance System", + "Due Date": "2024-08-31" + }, + { + "id": "project-63", + "Title": "Smart Agriculture Irrigation Management", + "Due Date": "2024-06-30" + }, + { + "id": "project-64", + "Title": "Blockchain Digital Asset Exchange Platform", + "Due Date": "2024-09-30" + }, + { + "id": "project-65", + "Title": "AI Chatbot Development", + "Due Date": "2024-07-15" + }, + { + "id": "project-66", + "Title": "Smart Home Health Monitoring System", + "Due Date": "2024-11-30" + }, + { + "id": "project-67", + "Title": "Cloud Gaming Streaming Platform", + "Due Date": "2024-10-15" + }, + { + "id": "project-68", + "Title": "IoT Smart Lighting Control", + "Due Date": "2024-08-15" + }, + { + "id": "project-69", + "Title": "Robotic Process Automation Platform", + "Due Date": "2024-12-15" + }, + { + "id": "project-70", + "Title": "Smart City Air Quality Monitoring", + "Due Date": "2024-09-15" + }, + { + "id": "project-71", + "Title": "Blockchain-based Supply Chain Financing", + "Due Date": "2024-11-15" + }, + { + "id": "project-72", + "Title": "AI-powered Fraud Detection System", + "Due Date": "2024-07-31" + }, + { + "id": "project-73", + "Title": "Smart Traffic Congestion Management", + "Due Date": "2024-10-31" + }, + { + "id": "project-74", + "Title": "Augmented Reality Retail Experience", + "Due Date": "2024-08-31" + }, + { + "id": "project-75", + "Title": "IoT-based Precision Agriculture System", + "Due Date": "2024-06-30" + }, + { + "id": "project-76", + "Title": "Quantum Computing Simulation Platform", + "Due Date": "2024-12-31" + }, + { + "id": "project-77", + "Title": "AI-driven Customer Segmentation Tool", + "Due Date": "2024-09-30" + }, + { + "id": "project-78", + "Title": "Smart City Emergency Response System", + "Due Date": "2024-11-30" + }, + { + "id": "project-79", + "Title": "Blockchain-based Voting System", + "Due Date": "2024-10-15" + }, + { + "id": "project-80", + "Title": "Virtual Reality Therapy Platform", + "Due Date": "2024-08-15" + }, + { + "id": "project-81", + "Title": "IoT-enabled Smart Office Solution", + "Due Date": "2024-07-15" + }, + { + "id": "project-82", + "Title": "AI-powered Personal Finance Assistant", + "Due Date": "2024-09-15" + }, + { + "id": "project-83", + "Title": "Drone Delivery Management System", + "Due Date": "2024-11-15" + }, + { + "id": "project-84", + "Title": "Blockchain-based Healthcare Data Exchange", + "Due Date": "2024-12-15" + }, + { + "id": "project-85", + "Title": "Smart City Noise Pollution Monitoring", + "Due Date": "2024-10-31" + }, + { + "id": "project-86", + "Title": "AI-driven HR Recruitment Platform", + "Due Date": "2024-08-31" + }, + { + "id": "project-87", + "Title": "IoT Fleet Management System", + "Due Date": "2024-07-31" + }, + { + "id": "project-88", + "Title": "Augmented Reality Maintenance Guide", + "Due Date": "2024-09-30" + }, + { + "id": "project-89", + "Title": "Blockchain-based Charity Donation Platform", + "Due Date": "2024-11-30" + }, + { + "id": "project-90", + "Title": "Smart Home Elderly Care System", + "Due Date": "2024-10-15" + }, + { + "id": "project-91", + "Title": "AI-powered Legal Document Analysis", + "Due Date": "2024-08-15" + }, + { + "id": "project-92", + "Title": "IoT-based Smart Irrigation System", + "Due Date": "2024-06-30" + }, + { + "id": "project-93", + "Title": "Blockchain Digital Identity Management", + "Due Date": "2024-12-31" + }, + { + "id": "project-94", + "Title": "Virtual Reality Real Estate Tour Platform", + "Due Date": "2024-11-15" + }, + { + "id": "project-95", + "Title": "AI-driven Predictive Maintenance for Industry", + "Due Date": "2024-09-15" + }, + { + "id": "project-96", + "Title": "Smart City Traffic Light Optimization", + "Due Date": "2024-07-15" + }, + { + "id": "project-97", + "Title": "IoT-based Smart Waste Collection", + "Due Date": "2024-10-31" + }, + { + "id": "project-98", + "Title": "Blockchain-based Intellectual Property Registry", + "Due Date": "2024-08-31" + }, + { + "id": "project-99", + "Title": "AI Language Translation Platform", + "Due Date": "2024-11-30" + }, + { + "id": "project-100", + "Title": "Smart Building Management System", + "Due Date": "2024-12-15" } ] }, @@ -99,10 +595,18 @@ } } }, - "BugsCount": { + "Project Due Date": { "type": "rollup", "option": { - "fn": "count", + "fn": "lookup", + "referenceFieldId": "projects", + "rollupFieldId": "dueDate" + } + }, + "Project Name": { + "type": "rollup", + "option": { + "fn": "lookup", "referenceFieldId": "projects", "rollupFieldId": "title" } @@ -193,8 +697,7 @@ "op": "is_not_empty" } ] - }, - "hidden": true + } } ] } @@ -202,20 +705,969 @@ "records": [ { "id": "bug-1", - "Title": "Bug 1", + "Title": "Login page not responsive on mobile devices", "Status": "inProgress", - "Projects": ["project-1"] + "Projects": ["project-2"] }, { "id": "bug-2", - "Title": "Bug 2", - "Projects": ["project-1"] + "Title": "Payment gateway timeout during high traffic", + "Status": "backlog", + "Projects": ["project-2"] }, { "id": "bug-3", - "Title": "Bug 3", + "Title": "User profile picture upload failing", "Status": "done", "Projects": ["project-2"] + }, + { + "id": "bug-4", + "Title": "Incorrect product recommendations in AI system", + "Status": "inProgress", + "Projects": ["project-4"] + }, + { + "id": "bug-5", + "Title": "Data synchronization issues in cloud storage", + "Status": "backlog", + "Projects": ["project-5"] + }, + { + "id": "bug-6", + "Title": "Blockchain transaction verification delay", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-7", + "Title": "VR headset causing motion sickness in education app", + "Status": "backlog", + "Projects": ["project-7"] + }, + { + "id": "bug-8", + "Title": "IoT device battery drain issue", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-9", + "Title": "Data visualization error in analytics dashboard", + "Status": "done", + "Projects": ["project-9"] + }, + { + "id": "bug-10", + "Title": "Firewall blocking legitimate traffic", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-11", + "Title": "Medical diagnosis system false positives", + "Status": "backlog", + "Projects": ["project-11"] + }, + { + "id": "bug-12", + "Title": "Renewable energy output calculation inaccuracy", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-13", + "Title": "Facial recognition failing in low light conditions", + "Status": "backlog", + "Projects": ["project-13"] + }, + { + "id": "bug-14", + "Title": "Traffic light synchronization error", + "Status": "inProgress", + "Projects": ["project-14"] + }, + { + "id": "bug-15", + "Title": "Video streaming lag in online course platform", + "Status": "done", + "Projects": ["project-15"] + }, + { + "id": "bug-16", + "Title": "Social media sentiment analysis accuracy issues", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-17", + "Title": "Soil moisture sensor calibration error", + "Status": "backlog", + "Projects": ["project-17"] + }, + { + "id": "bug-18", + "Title": "Telemedicine video call quality degradation", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-19", + "Title": "ERP system inventory tracking discrepancy", + "Status": "backlog", + "Projects": ["project-19"] + }, + { + "id": "bug-20", + "Title": "Warehouse robot collision avoidance failure", + "Status": "inProgress", + "Projects": ["project-20"] + }, + { + "id": "bug-21", + "Title": "AR navigation app GPS drift in urban areas", + "Status": "backlog", + "Projects": ["project-21"] + }, + { + "id": "bug-22", + "Title": "Voice control system misinterpreting commands", + "Status": "inProgress", + "Projects": ["project-22"] + }, + { + "id": "bug-23", + "Title": "Blockchain identity verification timeout", + "Status": "done", + "Projects": ["project-23"] + }, + { + "id": "bug-24", + "Title": "AI image recognition false negatives", + "Status": "inProgress", + "Projects": ["project-24"] + }, + { + "id": "bug-25", + "Title": "Energy consumption prediction algorithm inaccuracy", + "Status": "backlog", + "Projects": ["project-25"] + }, + { + "id": "bug-26", + "Title": "Machine learning model overfitting on test data", + "Status": "inProgress", + "Projects": ["project-26"] + }, + { + "id": "bug-27", + "Title": "IoT waste sorting system misclassification", + "Status": "backlog", + "Projects": ["project-27"] + }, + { + "id": "bug-28", + "Title": "Cloud resource allocation inefficiency", + "Status": "inProgress", + "Projects": ["project-28"] + }, + { + "id": "bug-29", + "Title": "Smart manufacturing line unexpected shutdowns", + "Status": "done", + "Projects": ["project-29"] + }, + { + "id": "bug-30", + "Title": "Network intrusion detection false alarms", + "Status": "inProgress", + "Projects": ["project-30"] + }, + { + "id": "bug-31", + "Title": "Building HVAC system energy waste", + "Status": "backlog", + "Projects": ["project-31"] + }, + { + "id": "bug-32", + "Title": "Blockchain voting system double-voting vulnerability", + "Status": "inProgress", + "Projects": ["project-32"] + }, + { + "id": "bug-33", + "Title": "NLP model misunderstanding context in conversations", + "Status": "backlog", + "Projects": ["project-33"] + }, + { + "id": "bug-34", + "Title": "Traffic signal optimization causing congestion", + "Status": "inProgress", + "Projects": ["project-34"] + }, + { + "id": "bug-35", + "Title": "VR training simulator causing disorientation", + "Status": "done", + "Projects": ["project-35"] + }, + { + "id": "bug-36", + "Title": "Customer behavior prediction model bias", + "Status": "inProgress", + "Projects": ["project-36"] + }, + { + "id": "bug-37", + "Title": "Smart water meter reading inaccuracies", + "Status": "backlog", + "Projects": ["project-37"] + }, + { + "id": "bug-38", + "Title": "Digital copyright protection system bypass", + "Status": "inProgress", + "Projects": ["project-38"] + }, + { + "id": "bug-39", + "Title": "AI recommendation engine suggesting irrelevant items", + "Status": "backlog", + "Projects": ["project-39"] + }, + { + "id": "bug-40", + "Title": "Home security system false alarms", + "Status": "inProgress", + "Projects": ["project-40"] + }, + { + "id": "bug-41", + "Title": "Cloud-native app scaling issues under high load", + "Status": "backlog", + "Projects": ["project-41"] + }, + { + "id": "bug-42", + "Title": "Smart parking system incorrect space availability", + "Status": "inProgress", + "Projects": ["project-42"] + }, + { + "id": "bug-43", + "Title": "RPA tool failing to handle exceptions", + "Status": "done", + "Projects": ["project-43"] + }, + { + "id": "bug-44", + "Title": "Environmental sensor calibration drift", + "Status": "inProgress", + "Projects": ["project-44"] + }, + { + "id": "bug-45", + "Title": "Blockchain payment system double-spending vulnerability", + "Status": "backlog", + "Projects": ["project-45"] + }, + { + "id": "bug-46", + "Title": "AI sentiment analysis misinterpreting sarcasm", + "Status": "inProgress", + "Projects": ["project-46"] + }, + { + "id": "bug-47", + "Title": "Smart home system unresponsive to voice commands", + "Status": "backlog", + "Projects": ["project-1"] + }, + { + "id": "bug-48", + "Title": "E-commerce platform search results irrelevance", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-49", + "Title": "Mobile payment app transaction failure", + "Status": "done", + "Projects": ["project-3"] + }, + { + "id": "bug-50", + "Title": "AI chatbot providing incorrect information", + "Status": "inProgress", + "Projects": ["project-4"] + }, + { + "id": "bug-51", + "Title": "Cloud storage data corruption during transfer", + "Status": "backlog", + "Projects": ["project-5"] + }, + { + "id": "bug-52", + "Title": "Blockchain supply chain tracking inconsistencies", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-53", + "Title": "VR education platform causing eye strain", + "Status": "backlog", + "Projects": ["project-7"] + }, + { + "id": "bug-54", + "Title": "IoT vehicle tracking system location inaccuracy", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-55", + "Title": "Big data analytics tool memory leak", + "Status": "done", + "Projects": ["project-9"] + }, + { + "id": "bug-56", + "Title": "Cybersecurity system failing to detect new threats", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-57", + "Title": "Medical diagnosis AI misclassifying rare conditions", + "Status": "backlog", + "Projects": ["project-11"] + }, + { + "id": "bug-58", + "Title": "Renewable energy forecasting model inaccuracy", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-59", + "Title": "Facial recognition system privacy concerns", + "Status": "backlog", + "Projects": ["project-13"] + }, + { + "id": "bug-60", + "Title": "Smart city traffic management causing gridlock", + "Status": "inProgress", + "Projects": ["project-14"] + }, + { + "id": "bug-61", + "Title": "Online education platform quiz grading errors", + "Status": "done", + "Projects": ["project-15"] + }, + { + "id": "bug-62", + "Title": "Social media data analysis privacy breach", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-63", + "Title": "Smart agriculture system overwatering crops", + "Status": "backlog", + "Projects": ["project-17"] + }, + { + "id": "bug-64", + "Title": "Telemedicine platform data encryption weakness", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-65", + "Title": "ERP system financial reporting discrepancies", + "Status": "backlog", + "Projects": ["project-19"] + }, + { + "id": "bug-66", + "Title": "Warehouse management AI misplacing inventory", + "Status": "inProgress", + "Projects": ["project-20"] + }, + { + "id": "bug-67", + "Title": "AR navigation app battery drain issue", + "Status": "done", + "Projects": ["project-21"] + }, + { + "id": "bug-68", + "Title": "Smart home voice control system security vulnerability", + "Status": "inProgress", + "Projects": ["project-22"] + }, + { + "id": "bug-69", + "Title": "Blockchain identity verification data leak", + "Status": "backlog", + "Projects": ["project-23"] + }, + { + "id": "bug-70", + "Title": "AI image recognition system bias", + "Status": "inProgress", + "Projects": ["project-24"] + }, + { + "id": "bug-71", + "Title": "Energy management platform causing power outages", + "Status": "backlog", + "Projects": ["project-25"] + }, + { + "id": "bug-72", + "Title": "Machine learning model performance degradation over time", + "Status": "inProgress", + "Projects": ["project-26"] + }, + { + "id": "bug-73", + "Title": "IoT waste sorting system contamination issues", + "Status": "done", + "Projects": ["project-27"] + }, + { + "id": "bug-74", + "Title": "Cloud computing resource over-allocation", + "Status": "inProgress", + "Projects": ["project-28"] + }, + { + "id": "bug-75", + "Title": "Smart manufacturing quality control false negatives", + "Status": "backlog", + "Projects": ["project-29"] + }, + { + "id": "bug-76", + "Title": "Network security system performance bottleneck", + "Status": "inProgress", + "Projects": ["project-30"] + }, + { + "id": "bug-77", + "Title": "Building energy management system sensor failures", + "Status": "backlog", + "Projects": ["project-31"] + }, + { + "id": "bug-78", + "Title": "Blockchain voting system audit trail gaps", + "Status": "inProgress", + "Projects": ["project-32"] + }, + { + "id": "bug-79", + "Title": "NLP model struggling with multilingual input", + "Status": "done", + "Projects": ["project-33"] + }, + { + "id": "bug-80", + "Title": "Intelligent traffic control causing pedestrian delays", + "Status": "inProgress", + "Projects": ["project-34"] + }, + { + "id": "bug-81", + "Title": "VR training simulator graphics rendering issues", + "Status": "backlog", + "Projects": ["project-35"] + }, + { + "id": "bug-82", + "Title": "Customer behavior analysis privacy concerns", + "Status": "inProgress", + "Projects": ["project-36"] + }, + { + "id": "bug-83", + "Title": "Smart water management system leak detection failures", + "Status": "backlog", + "Projects": ["project-37"] + }, + { + "id": "bug-84", + "Title": "Blockchain copyright system content fingerprinting errors", + "Status": "inProgress", + "Projects": ["project-38"] + }, + { + "id": "bug-85", + "Title": "AI recommendation engine filter bubble effect", + "Status": "done", + "Projects": ["project-39"] + }, + { + "id": "bug-86", + "Title": "Smart home security system camera blind spots", + "Status": "inProgress", + "Projects": ["project-40"] + }, + { + "id": "bug-87", + "Title": "Cloud-native app container orchestration failures", + "Status": "backlog", + "Projects": ["project-41"] + }, + { + "id": "bug-88", + "Title": "IoT parking management payment processing errors", + "Status": "inProgress", + "Projects": ["project-42"] + }, + { + "id": "bug-89", + "Title": "RPA tool incompatibility with legacy systems", + "Status": "backlog", + "Projects": ["project-43"] + }, + { + "id": "bug-90", + "Title": "Environmental monitoring system data transmission delays", + "Status": "inProgress", + "Projects": ["project-44"] + }, + { + "id": "bug-91", + "Title": "Blockchain payment system transaction reversal issues", + "Status": "done", + "Projects": ["project-45"] + }, + { + "id": "bug-92", + "Title": "AI sentiment analysis struggling with context", + "Status": "inProgress", + "Projects": ["project-46"] + }, + { + "id": "bug-93", + "Title": "Smart home system integration conflicts", + "Status": "backlog", + "Projects": ["project-1"] + }, + { + "id": "bug-94", + "Title": "E-commerce platform product recommendation irrelevance", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-95", + "Title": "Mobile payment app security vulnerabilities", + "Status": "backlog", + "Projects": ["project-3"] + }, + { + "id": "bug-96", + "Title": "AI customer service system language model hallucinations", + "Status": "inProgress", + "Projects": ["project-4"] + }, + { + "id": "bug-97", + "Title": "Cloud storage system data retrieval latency", + "Status": "done", + "Projects": ["project-5"] + }, + { + "id": "bug-98", + "Title": "Blockchain supply chain product authenticity verification failures", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-99", + "Title": "VR education platform content loading issues", + "Status": "backlog", + "Projects": ["project-7"] + }, + { + "id": "bug-100", + "Title": "IoT vehicle tracking battery life optimization needed", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-101", + "Title": "Big data analytics tool query performance issues", + "Status": "backlog", + "Projects": ["project-9"] + }, + { + "id": "bug-102", + "Title": "Cybersecurity system update deployment failures", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-103", + "Title": "Medical diagnosis AI explainability concerns", + "Status": "done", + "Projects": ["project-11"] + }, + { + "id": "bug-104", + "Title": "Renewable energy management load balancing issues", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-105", + "Title": "Facial recognition access control tailgating vulnerability", + "Status": "backlog", + "Projects": ["project-13"] + }, + { + "id": "bug-106", + "Title": "Smart city traffic management emergency vehicle prioritization failures", + "Status": "inProgress", + "Projects": ["project-14"] + }, + { + "id": "bug-107", + "Title": "Online education course content version control issues", + "Status": "backlog", + "Projects": ["project-15"] + }, + { + "id": "bug-108", + "Title": "Social media data analysis tool API rate limiting", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-109", + "Title": "Smart agriculture pest detection false positives", + "Status": "done", + "Projects": ["project-17"] + }, + { + "id": "bug-110", + "Title": "Telemedicine platform video quality degradation", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-111", + "Title": "ERP system module integration conflicts", + "Status": "backlog", + "Projects": ["project-19"] + }, + { + "id": "bug-112", + "Title": "Intelligent warehouse management system picking errors", + "Status": "inProgress", + "Projects": ["project-20"] + }, + { + "id": "bug-113", + "Title": "AR navigation app landmark recognition failures", + "Status": "backlog", + "Projects": ["project-21"] + }, + { + "id": "bug-114", + "Title": "Smart home voice control wake word false activations", + "Status": "inProgress", + "Projects": ["project-22"] + }, + { + "id": "bug-115", + "Title": "Blockchain digital identity system user onboarding friction", + "Status": "done", + "Projects": ["project-23"] + }, + { + "id": "bug-116", + "Title": "AI image recognition system adversarial attack vulnerability", + "Status": "inProgress", + "Projects": ["project-24"] + }, + { + "id": "bug-117", + "Title": "Intelligent energy management demand forecasting inaccuracies", + "Status": "backlog", + "Projects": ["project-25"] + }, + { + "id": "bug-118", + "Title": "Machine learning predictive maintenance false alarms", + "Status": "inProgress", + "Projects": ["project-26"] + }, + { + "id": "bug-119", + "Title": "IoT smart waste sorting system sensor malfunctions", + "Status": "backlog", + "Projects": ["project-27"] + }, + { + "id": "bug-120", + "Title": "Cloud computing resource scheduling inefficiencies", + "Status": "inProgress", + "Projects": ["project-28"] + }, + { + "id": "bug-121", + "Title": "Smart manufacturing production line bottleneck detection failures", + "Status": "done", + "Projects": ["project-29"] + }, + { + "id": "bug-122", + "Title": "Network security threat intelligence feed integration issues", + "Status": "inProgress", + "Projects": ["project-30"] + }, + { + "id": "bug-123", + "Title": "Intelligent building management system HVAC control instability", + "Status": "backlog", + "Projects": ["project-31"] + }, + { + "id": "bug-124", + "Title": "Blockchain electronic voting system voter authentication challenges", + "Status": "inProgress", + "Projects": ["project-32"] + }, + { + "id": "bug-125", + "Title": "AI natural language processing model bias in translations", + "Status": "backlog", + "Projects": ["project-33"] + }, + { + "id": "bug-126", + "Title": "Intelligent traffic signal control system pedestrian safety concerns", + "Status": "inProgress", + "Projects": ["project-34"] + }, + { + "id": "bug-127", + "Title": "VR training simulator motion tracking latency", + "Status": "done", + "Projects": ["project-35"] + }, + { + "id": "bug-128", + "Title": "Big data customer behavior analysis data quality issues", + "Status": "inProgress", + "Projects": ["project-36"] + }, + { + "id": "bug-129", + "Title": "Smart water resource management system pipe burst detection delays", + "Status": "backlog", + "Projects": ["project-37"] + }, + { + "id": "bug-130", + "Title": "Blockchain digital copyright protection content piracy vulnerabilities", + "Status": "inProgress", + "Projects": ["project-38"] + }, + { + "id": "bug-131", + "Title": "AI recommendation engine cold start problem for new users", + "Status": "backlog", + "Projects": ["project-39"] + }, + { + "id": "bug-132", + "Title": "Smart home security monitoring false alarm rate", + "Status": "inProgress", + "Projects": ["project-40"] + }, + { + "id": "bug-133", + "Title": "Cloud-native application development CI/CD pipeline failures", + "Status": "done", + "Projects": ["project-41"] + }, + { + "id": "bug-134", + "Title": "IoT smart parking occupancy sensor accuracy issues", + "Status": "inProgress", + "Projects": ["project-42"] + }, + { + "id": "bug-135", + "Title": "Robotic process automation script maintenance challenges", + "Status": "backlog", + "Projects": ["project-43"] + }, + { + "id": "bug-136", + "Title": "Intelligent environmental monitoring system data interpolation errors", + "Status": "inProgress", + "Projects": ["project-44"] + }, + { + "id": "bug-137", + "Title": "Blockchain cross-border payment system regulatory compliance issues", + "Status": "backlog", + "Projects": ["project-45"] + }, + { + "id": "bug-138", + "Title": "AI sentiment analysis system struggling with emojis and slang", + "Status": "inProgress", + "Projects": ["project-46"] + }, + { + "id": "bug-139", + "Title": "Smart home system device compatibility issues", + "Status": "done", + "Projects": ["project-1"] + }, + { + "id": "bug-140", + "Title": "E-commerce platform inventory synchronization delays", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-141", + "Title": "Mobile payment app cross-platform consistency issues", + "Status": "backlog", + "Projects": ["project-3"] + }, + { + "id": "bug-142", + "Title": "AI customer service chatbot context retention problems", + "Status": "inProgress", + "Projects": ["project-4"] + }, + { + "id": "bug-143", + "Title": "Cloud storage system data deduplication inefficiencies", + "Status": "backlog", + "Projects": ["project-5"] + }, + { + "id": "bug-144", + "Title": "Blockchain supply chain management system scalability limitations", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-145", + "Title": "VR education platform user interface accessibility issues", + "Status": "done", + "Projects": ["project-7"] + }, + { + "id": "bug-146", + "Title": "IoT vehicle tracking system cellular network coverage gaps", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-147", + "Title": "Big data analytics tool data visualization rendering issues", + "Status": "backlog", + "Projects": ["project-9"] + }, + { + "id": "bug-148", + "Title": "Cybersecurity enhancement system false positive rate", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-149", + "Title": "Medical diagnosis AI system integration with EHR challenges", + "Status": "backlog", + "Projects": ["project-11"] + }, + { + "id": "bug-150", + "Title": "Renewable energy management platform grid stability issues", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-151", + "Title": "Facial recognition access control system performance in varying lighting", + "Status": "done", + "Projects": ["project-13"] + }, + { + "id": "bug-152", + "Title": "Smart city traffic management system sensor data inconsistencies", + "Status": "inProgress", + "Projects": ["project-14"] + }, + { + "id": "bug-153", + "Title": "Online education course platform user engagement tracking inaccuracies", + "Status": "backlog", + "Projects": ["project-15"] + }, + { + "id": "bug-154", + "Title": "Social media data analysis tool data normalization issues", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-155", + "Title": "Smart agriculture monitoring system weather data integration challenges", + "Status": "backlog", + "Projects": ["project-17"] + }, + { + "id": "bug-156", + "Title": "Telemedicine consultation platform scheduling conflicts", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-157", + "Title": "ERP system upgrade data migration errors", + "Status": "done", + "Projects": ["project-19"] + }, + { + "id": "bug-158", + "Title": "Intelligent warehouse management solution inventory discrepancies", + "Status": "inProgress", + "Projects": ["project-20"] + }, + { + "id": "bug-159", + "Title": "AR navigation app POI database update delays", + "Status": "backlog", + "Projects": ["project-21"] + }, + { + "id": "bug-160", + "Title": "Smart home voice control system multi-language support issues", + "Status": "inProgress", + "Projects": ["project-22"] + }, + { + "id": "bug-161", + "Title": "Blockchain digital identity verification system performance bottlenecks", + "Status": "backlog", + "Projects": ["project-23"] } ] } From 2aaef4ed1a9abd632ff902eaeea3678d34496ca4 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 10:31:00 +0800 Subject: [PATCH 03/16] feat: lookup foreign select field --- .../persistence/src/record/record-utils.ts | 25 ++++++++++--------- .../src/modules/schema/fields/field.util.ts | 3 ++- .../variants/select-field/select-field.vo.ts | 4 +++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/packages/persistence/src/record/record-utils.ts b/packages/persistence/src/record/record-utils.ts index 0740d285c..389a2718a 100644 --- a/packages/persistence/src/record/record-utils.ts +++ b/packages/persistence/src/record/record-utils.ts @@ -123,30 +123,31 @@ export function getRecordDTOFromEntity(table: TableDo, entity: any, foreignTable if (field.type === "rollup" && field.fn === "lookup") { const foreignTable = field.getForeignTable(table, foreignTables) - let isLookupDate = false + let lookupField: Field | undefined = undefined if (foreignTable) { const rollupField = field.getRollupField(foreignTable) if (rollupField.isSome()) { - const type = rollupField.unwrap().type - if (type === "date") { - isLookupDate = true - } + lookupField = rollupField.unwrap() } } - if (Array.isArray(value)) { - if (isLookupDate) { - values[key] = value.map((v: string | number) => new Date(v).toISOString()).map(formatter) + function handleValue(value: (string | number)[]) { + if (lookupField?.type === "date") { + return value.map((v: string | number) => new Date(v).toISOString()).map(formatter) + } else if (lookupField?.type === "select") { + return value.map((v) => lookupField.getOptionById(v)?.name) } else { - values[key] = value + return value } + } + + if (Array.isArray(value)) { + values[key] = handleValue(value) continue } else if (isString(value)) { try { values[key] = JSON.parse(value) - if (isLookupDate) { - values[key] = values[key].map((v: string) => new Date(v).toISOString()) - } + values[key] = handleValue(values[key]) } catch (error) { logger.warn({ error, value }, "Error parsing JSON") values[key] = [value] diff --git a/packages/table/src/modules/schema/fields/field.util.ts b/packages/table/src/modules/schema/fields/field.util.ts index 9ebbb93f8..55a2b7382 100644 --- a/packages/table/src/modules/schema/fields/field.util.ts +++ b/packages/table/src/modules/schema/fields/field.util.ts @@ -213,6 +213,7 @@ export const fieldsCanBeRollup: FieldType[] = [ "currency", "duration", "percentage", + "select", ] as const export const getIsFieldCanBeRollup = (type: FieldType): type is "number" => { @@ -231,7 +232,7 @@ export function getRollupFnByType(type: FieldType): IRollupFn[] { "lookup", ]) .with("date", () => ["max", "min", "count", "lookup"]) - .with("string", "email", "url", "checkbox", () => ["lookup", "count"]) + .with("string", "email", "url", "checkbox", "select", () => ["lookup", "count"]) .otherwise(() => []) } diff --git a/packages/table/src/modules/schema/fields/variants/select-field/select-field.vo.ts b/packages/table/src/modules/schema/fields/variants/select-field/select-field.vo.ts index 6188c884b..ce002562e 100644 --- a/packages/table/src/modules/schema/fields/variants/select-field/select-field.vo.ts +++ b/packages/table/src/modules/schema/fields/variants/select-field/select-field.vo.ts @@ -145,6 +145,10 @@ export class SelectField extends AbstractField o.id === id) + } + getNextColor() { return new ColorsVO().next(this.options[this.options.length - 1]?.color) } From 1d2116cdd3cea1f8862ccd9f6c407020bde15571 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 11:08:13 +0800 Subject: [PATCH 04/16] feat: create view allow to add option & fields --- .../blocks/field-value/rollup-field.svelte | 44 ++++++++++++------ .../blocks/view-fields/view-fields.svelte | 4 +- .../table/src/methods/create-field.method.ts | 2 +- .../table/src/methods/create-view.method.ts | 2 +- .../table/src/methods/delete-field.method.ts | 2 +- .../src/modules/views/dto/create-view.dto.ts | 4 +- .../views/view/variants/abstract-view.vo.ts | 21 +++++---- .../views/view/variants/gallery-view.vo.ts | 17 +++---- .../views/view/variants/grid-view.vo.ts | 17 +++---- .../views/view/variants/kanban-view.vo.ts | 17 +++---- .../views/view/view-fields/view-fields.vo.ts | 46 ++++++++++++------- .../src/modules/views/view/view.factory.ts | 17 +++---- packages/table/src/modules/views/views.vo.ts | 35 +++++++------- .../table-view.specification.ts | 10 ++-- packages/table/src/table.builder.ts | 4 +- packages/template/src/template.factory.ts | 1 - .../src/templates/projectManagement.base.json | 4 ++ 17 files changed, 143 insertions(+), 104 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte b/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte index e2192a8c4..565b19d10 100644 --- a/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte +++ b/apps/frontend/src/lib/components/blocks/field-value/rollup-field.svelte @@ -13,26 +13,40 @@ {#if !!value} {#if fn === "lookup" && Array.isArray(value)}
- {#each value as item} - {#if !!item} - - {item} - - {:else} - - Unamed - - {/if} - {/each} + {#if !value.length} + + - + + {:else} + {#each value as item} + {#if !!item} + + {item} + + {:else} + + Unamed + + {/if} + {/each} + {/if}
{:else if isNumber(value)} {value} {/if} + {:else} + + - + {/if} diff --git a/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte b/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte index a889a9274..c4a24e1d8 100644 --- a/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte +++ b/apps/frontend/src/lib/components/blocks/view-fields/view-fields.svelte @@ -178,7 +178,7 @@ class="flex-1 shadow-sm" size="sm" on:click={() => { - viewFields = viewFieldsVo.showAllFields().toJSON() + viewFields = viewFieldsVo.showAllFields($table).toJSON() setViewFields() }} > @@ -190,7 +190,7 @@ class="flex-1 shadow-sm" size="sm" on:click={() => { - viewFields = viewFieldsVo.hideAllFields().toJSON() + viewFields = viewFieldsVo.hideAllFields($table).toJSON() setViewFields() }} > diff --git a/packages/table/src/methods/create-field.method.ts b/packages/table/src/methods/create-field.method.ts index 21c9c2fce..3adb847f4 100644 --- a/packages/table/src/methods/create-field.method.ts +++ b/packages/table/src/methods/create-field.method.ts @@ -9,7 +9,7 @@ import type { TableDo } from "../table.do" export function $createFieldSpec(this: TableDo, field: Field): Option { const createFieldSpec = this.schema.$createField(field) const formAddFieldSpec = this.forms?.$addField(field) - const viewAddFieldSpec = this.views.$addField(field) + const viewAddFieldSpec = this.views.$addField(this, field) const spec = andOptions( Some(createFieldSpec), diff --git a/packages/table/src/methods/create-view.method.ts b/packages/table/src/methods/create-view.method.ts index 28b971c6c..87f1e6c01 100644 --- a/packages/table/src/methods/create-view.method.ts +++ b/packages/table/src/methods/create-view.method.ts @@ -10,7 +10,7 @@ export function createViewMethod( this: TableDo, dto: ICreateViewDTO, ): { spec: Option; view: View } { - const view = ViewFactory.create(dto) + const view = ViewFactory.create(this, dto) const spec = new WithNewView(view) spec.mutate(this) diff --git a/packages/table/src/methods/delete-field.method.ts b/packages/table/src/methods/delete-field.method.ts index 17159ef2e..337fe1394 100644 --- a/packages/table/src/methods/delete-field.method.ts +++ b/packages/table/src/methods/delete-field.method.ts @@ -10,7 +10,7 @@ export function deleteFieldMethod(this: TableDo, dto: IDeleteFieldDTO): [Field, const field = this.schema.getFieldById(new FieldIdVo(dto.id)).expect("field not found") const deleteFieldSpec = this.schema.$deleteField(dto) const formDeleteFieldSpec = this.forms?.$deleteField(field) - const viewDeleteFieldSpec = this.views.$deleteField(field) + const viewDeleteFieldSpec = this.views.$deleteField(this, field) const rlsDeleteFieldSpec = this.rls.into(undefined)?.$deleteField(field) const spec = andOptions( diff --git a/packages/table/src/modules/views/dto/create-view.dto.ts b/packages/table/src/modules/views/dto/create-view.dto.ts index 97fd68c8a..a68eaf059 100644 --- a/packages/table/src/modules/views/dto/create-view.dto.ts +++ b/packages/table/src/modules/views/dto/create-view.dto.ts @@ -1,6 +1,6 @@ import { z } from "@undb/zod" import { tableId } from "../../../table-id.vo" -import { viewColorGroup, viewFields, viewFilterGroup, viewSort } from "../view" +import { viewColorGroup, viewFields, viewFilterGroup, viewOption, viewSort } from "../view" import { galleryOption } from "../view/variants/gallery-view.vo" import { kanbanOption } from "../view/variants/kanban-view.vo" import { viewId } from "../view/view-id.vo" @@ -11,6 +11,8 @@ export const createBaseViewDTO = z.object({ id: viewId.optional(), name: viewName, type: viewType, + + option: viewOption.optional(), filter: viewFilterGroup.optional(), color: viewColorGroup.optional(), sort: viewSort.optional(), 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 b5e13353b..a185a5b55 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 @@ -14,6 +14,7 @@ import { WithoutView, } from "../../../../specifications/table-view.specification" import { tableId } from "../../../../table-id.vo" +import type { TableDo } from "../../../../table.do" import type { Field } from "../../../schema" import type { IViewDTO } from "../dto" import { ViewAggregateVO, viewAggregate, type IViewAggregate } from "../view-aggregate/view-aggregate.vo" @@ -69,7 +70,7 @@ export abstract class AbstractView { abstract type: ViewType - constructor(dto: IBaseViewDTO) { + constructor(table: TableDo, dto: IBaseViewDTO) { this.id = new ViewIdVo(dto.id) this.name = new ViewNameVo(dto.name) this.isDefault = dto.isDefault ?? false @@ -86,7 +87,7 @@ export abstract class AbstractView { this.setAggregate(dto.aggregate) } if (dto.fields) { - this.setFields(dto.fields) + this.setFields(table, dto.fields) } if (dto.option) { this.setOption(dto.option) @@ -112,8 +113,8 @@ export abstract class AbstractView { return Some(new WithViewOption(this.id, Option(previous), option)) } - abstract $update(input: IUpdateViewDTO): Option - abstract $duplicate(dto: IDuplicateViewDTO): Option + abstract $update(table: TableDo, input: IUpdateViewDTO): Option + abstract $duplicate(table: TableDo, dto: IDuplicateViewDTO): Option $delete(): Option { return Some(new WithoutView(this as unknown as View)) @@ -177,8 +178,8 @@ export abstract class AbstractView { return Some(new WithViewAggregate(this.id, Option(previous), aggregate)) } - setFields(fields: IViewFields) { - this.fields = Some(new ViewFields(fields)) + setFields(table: TableDo, fields: IViewFields) { + this.fields = Some(new ViewFields(table, fields)) } $setFieldsSpec(fields: IViewFields): Option { @@ -190,22 +191,22 @@ export abstract class AbstractView { return Some(new WithViewFields(this.id, Option(previous), fields)) } - $addField(field: Field): Option { + $addField(table: TableDo, field: Field): Option { if (this.fields.isNone()) { return None } const previous = this.fields.into(null)?.value - const fields = this.fields.unwrap().addField(field) + const fields = this.fields.unwrap().addField(table, field) return Some(new WithViewFields(this.id, Option(previous), fields.toJSON())) } - $deleteField(field: Field): Option { + $deleteField(table: TableDo, field: Field): Option { let specs: TableComositeSpecification[] = [] if (this.fields.isSome()) { const previous = this.fields.into(null)?.value - const fields = this.fields.unwrap().deleteField(field) + const fields = this.fields.unwrap().deleteField(table, field) specs.push(new WithViewFields(this.id, Option(previous), fields.toJSON())) } diff --git a/packages/table/src/modules/views/view/variants/gallery-view.vo.ts b/packages/table/src/modules/views/view/variants/gallery-view.vo.ts index 47f52de6c..867bae4c1 100644 --- a/packages/table/src/modules/views/view/variants/gallery-view.vo.ts +++ b/packages/table/src/modules/views/view/variants/gallery-view.vo.ts @@ -2,6 +2,7 @@ import { None, Option, Some } from "@undb/domain" import { z } from "@undb/zod" import type { IDuplicateViewDTO } from "../../../../dto/duplicate-view.dto" import { WithNewView, WithView } from "../../../../specifications/table-view.specification" +import type { TableDo } from "../../../../table.do" import { fieldId } from "../../../schema" import { ViewIdVo } from "../view-id.vo" import { AbstractView, baseViewDTO, createBaseViewDTO, updateBaseViewDTO } from "./abstract-view.vo" @@ -44,20 +45,20 @@ export class GalleryView extends AbstractView { return this.gallery.map((x) => x.field) } - constructor(dto: IGalleryViewDTO) { - super(dto) + constructor(table: TableDo, dto: IGalleryViewDTO) { + super(table, dto) this.gallery = Option(dto.gallery) } - static create(dto: ICreateGalleryViewDTO) { - return new GalleryView({ ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) + static create(table: TableDo, dto: ICreateGalleryViewDTO) { + return new GalleryView(table, { ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) } override type = GALLERY_TYPE - override $update(input: IUpdateGalleryViewDTO): Option { + override $update(table: TableDo, input: IUpdateGalleryViewDTO): Option { const json = this.toJSON() - const view = new GalleryView({ + const view = new GalleryView(table, { ...json, name: input.name, id: this.id.value, @@ -68,12 +69,12 @@ export class GalleryView extends AbstractView { return Some(new WithView(this, view)) } - override $duplicate(dto: IDuplicateViewDTO): Option { + override $duplicate(table: TableDo, dto: IDuplicateViewDTO): Option { const json = this.toJSON() return Some( new WithNewView( - new GalleryView({ + new GalleryView(table, { ...json, name: dto.name, gallery: this.gallery.into(undefined), diff --git a/packages/table/src/modules/views/view/variants/grid-view.vo.ts b/packages/table/src/modules/views/view/variants/grid-view.vo.ts index 199cb245c..33d7455fd 100644 --- a/packages/table/src/modules/views/view/variants/grid-view.vo.ts +++ b/packages/table/src/modules/views/view/variants/grid-view.vo.ts @@ -2,6 +2,7 @@ import { None, Option, Some } from "@undb/domain" import { z } from "@undb/zod" import type { IDuplicateViewDTO } from "../../../../dto" import { WithNewView, WithView, WithViewFieldWidth } from "../../../../specifications/table-view.specification" +import type { TableDo } from "../../../../table.do" import { FieldIdVo } from "../../../schema/fields/field-id.vo" import { ViewIdVo } from "../view-id.vo" import { AbstractView, baseViewDTO, createBaseViewDTO, updateBaseViewDTO } from "./abstract-view.vo" @@ -39,13 +40,13 @@ export type IUpdateGridViewDTO = z.infer export class GridView extends AbstractView { grid: Option = None - constructor(dto: IGridViewDTO) { - super(dto) + constructor(table: TableDo, dto: IGridViewDTO) { + super(table, dto) this.grid = Option(dto.grid) } - static create(dto: ICreateGridViewDTO) { - return new GridView({ ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) + static create(table: TableDo, dto: ICreateGridViewDTO) { + return new GridView(table, { ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) } getFieldWidth(fieldId: string) { @@ -73,9 +74,9 @@ export class GridView extends AbstractView { override type = GRID_TYPE - override $update(input: IUpdateGridViewDTO): Option { + override $update(table: TableDo, input: IUpdateGridViewDTO): Option { const json = this.toJSON() - const view = new GridView({ + const view = new GridView(table, { ...json, name: input.name, id: this.id.value, @@ -86,12 +87,12 @@ export class GridView extends AbstractView { return Some(new WithView(this, view)) } - override $duplicate(dto: IDuplicateViewDTO): Option { + override $duplicate(table: TableDo, dto: IDuplicateViewDTO): Option { const json = this.toJSON() return Some( new WithNewView( - new GridView({ + new GridView(table, { ...json, name: dto.name, isDefault: false, diff --git a/packages/table/src/modules/views/view/variants/kanban-view.vo.ts b/packages/table/src/modules/views/view/variants/kanban-view.vo.ts index dcc7a2dce..c4e293c0a 100644 --- a/packages/table/src/modules/views/view/variants/kanban-view.vo.ts +++ b/packages/table/src/modules/views/view/variants/kanban-view.vo.ts @@ -2,6 +2,7 @@ import { None, Option, Some } from "@undb/domain" import { z } from "@undb/zod" import type { IDuplicateViewDTO } from "../../../../dto/duplicate-view.dto" import { WithNewView, WithView } from "../../../../specifications/table-view.specification" +import type { TableDo } from "../../../../table.do" import { fieldId } from "../../../schema" import { ViewIdVo } from "../view-id.vo" import { AbstractView, baseViewDTO, createBaseViewDTO, updateBaseViewDTO } from "./abstract-view.vo" @@ -44,20 +45,20 @@ export class KanbanView extends AbstractView { return this.kanban.map((x) => x.field) } - constructor(dto: IKanbanViewDTO) { - super(dto) + constructor(table: TableDo, dto: IKanbanViewDTO) { + super(table, dto) this.kanban = Option(dto.kanban) } - static create(dto: ICreateKanbanViewDTO) { - return new KanbanView({ ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) + static create(table: TableDo, dto: ICreateKanbanViewDTO) { + return new KanbanView(table, { ...dto, id: ViewIdVo.fromStringOrCreate(dto.id).value }) } override type = KANBAN_TYPE - override $update(input: IUpdateKanbanViewDTO): Option { + override $update(table: TableDo, input: IUpdateKanbanViewDTO): Option { const json = this.toJSON() - const view = new KanbanView({ + const view = new KanbanView(table, { ...json, name: input.name, id: this.id.value, @@ -68,12 +69,12 @@ export class KanbanView extends AbstractView { return Some(new WithView(this, view)) } - override $duplicate(dto: IDuplicateViewDTO): Option { + override $duplicate(table: TableDo, dto: IDuplicateViewDTO): Option { const json = this.toJSON() return Some( new WithNewView( - new KanbanView({ + new KanbanView(table, { ...json, name: dto.name, kanban: this.kanban.into(undefined), diff --git a/packages/table/src/modules/views/view/view-fields/view-fields.vo.ts b/packages/table/src/modules/views/view/view-fields/view-fields.vo.ts index 72be5d3e6..68c9a293b 100644 --- a/packages/table/src/modules/views/view/view-fields/view-fields.vo.ts +++ b/packages/table/src/modules/views/view/view-fields/view-fields.vo.ts @@ -14,17 +14,22 @@ export const viewFields = viewField.array() export type IViewFields = z.infer export class ViewFields extends ValueObject { - constructor(props: IViewFields) { - super(props) + constructor(table: TableDo, props: IViewFields) { + const fields = table.schema.fields.map((field) => { + const exists = props.find((f) => f.fieldId === field.id.value) + if (exists) { + return exists + } + return { + fieldId: field.id.value, + hidden: false, + } + }) + super(fields) } static default(table: TableDo): ViewFields { - return new ViewFields( - table.schema.fields.map((field) => ({ - fieldId: field.id.value, - hidden: false, - })), - ) + return new ViewFields(table, []) } public isEqual(sort: IViewFields): boolean { @@ -55,19 +60,28 @@ export class ViewFields extends ValueObject { return this.getHiddenFields().length } - public addField(field: Field): ViewFields { - return new ViewFields([...this.props, { fieldId: field.id.value, hidden: false }]) + public addField(table: TableDo, field: Field): ViewFields { + return new ViewFields(table, [...this.props, { fieldId: field.id.value, hidden: false }]) } - public deleteField(field: Field): ViewFields { - return new ViewFields(this.props.filter((f) => f.fieldId !== field.id.value)) + public deleteField(table: TableDo, field: Field): ViewFields { + return new ViewFields( + table, + this.props.filter((f) => f.fieldId !== field.id.value), + ) } - public showAllFields(): ViewFields { - return new ViewFields(this.props.map((field) => ({ ...field, hidden: false }))) + public showAllFields(table: TableDo): ViewFields { + return new ViewFields( + table, + this.props.map((field) => ({ ...field, hidden: false })), + ) } - public hideAllFields(): ViewFields { - return new ViewFields(this.props.map((field) => ({ ...field, hidden: true }))) + public hideAllFields(table: TableDo): ViewFields { + return new ViewFields( + table, + this.props.map((field) => ({ ...field, hidden: true })), + ) } } diff --git a/packages/table/src/modules/views/view/view.factory.ts b/packages/table/src/modules/views/view/view.factory.ts index 01a1d62aa..ddadd13f8 100644 --- a/packages/table/src/modules/views/view/view.factory.ts +++ b/packages/table/src/modules/views/view/view.factory.ts @@ -1,4 +1,5 @@ import { match } from "ts-pattern" +import type { TableDo } from "../../../table.do" import type { ICreateViewDTO } from "../dto/create-view.dto" import type { IViewDTO } from "./dto/view.dto" import { GalleryView } from "./variants/gallery-view.vo" @@ -6,19 +7,19 @@ import { GridView } from "./variants/grid-view.vo" import { KanbanView } from "./variants/kanban-view.vo" export class ViewFactory { - static create(dto: ICreateViewDTO) { + static create(table: TableDo, dto: ICreateViewDTO) { return match(dto) - .with({ type: "grid" }, (dto) => GridView.create(dto)) - .with({ type: "kanban" }, (dto) => KanbanView.create(dto)) - .with({ type: "gallery" }, (dto) => GalleryView.create(dto)) + .with({ type: "grid" }, (dto) => GridView.create(table, dto)) + .with({ type: "kanban" }, (dto) => KanbanView.create(table, dto)) + .with({ type: "gallery" }, (dto) => GalleryView.create(table, dto)) .exhaustive() } - static fromJSON(dto: IViewDTO) { + static fromJSON(table: TableDo, dto: IViewDTO) { return match(dto) - .with({ type: "grid" }, (dto) => new GridView(dto)) - .with({ type: "kanban" }, (dto) => new KanbanView(dto)) - .with({ type: "gallery" }, (dto) => new GalleryView(dto)) + .with({ type: "grid" }, (dto) => new GridView(table, dto)) + .with({ type: "kanban" }, (dto) => new KanbanView(table, dto)) + .with({ type: "gallery" }, (dto) => new GalleryView(table, dto)) .exhaustive() } } diff --git a/packages/table/src/modules/views/views.vo.ts b/packages/table/src/modules/views/views.vo.ts index c2582230e..09edf9809 100644 --- a/packages/table/src/modules/views/views.vo.ts +++ b/packages/table/src/modules/views/views.vo.ts @@ -1,6 +1,7 @@ import { and, andOptions, None, Option, ValueObject } from "@undb/domain" import type { ISetDefaultViewDTO } from "../../dto/set-default-view.dto" import { WithView, type TableComositeSpecification } from "../../specifications" +import type { TableDo } from "../../table.do" import type { Field } from "../schema" import type { ICreateViewDTO, IViewsDTO } from "./dto" import { GridView } from "./view/variants/grid-view.vo" @@ -13,33 +14,33 @@ export class Views extends ValueObject { super(views) } - static create(views?: ICreateViewDTO[]) { + static create(table: TableDo, views?: ICreateViewDTO[]) { if (views?.length) { let vs = new Views([]) - const vsDTO = views.map((view) => ViewFactory.create(view)) + const vsDTO = views.map((view) => ViewFactory.create(table, view)) for (const view of vsDTO) { - vs = vs.addView(view) + vs = vs.addView(table, view) } return vs } - return new Views([GridView.create({ name: "default", type: "grid", isDefault: true })]) + return new Views([GridView.create(table, { name: "default", type: "grid", isDefault: true })]) } toJSON(): IViewsDTO { return this.views.map((view) => view.toJSON()) } - static fromJSON(dto: IViewsDTO) { - const views = dto.map((view) => ViewFactory.fromJSON(view)) + static fromJSON(table: TableDo, dto: IViewsDTO) { + const views = dto.map((view) => ViewFactory.fromJSON(table, view)) return new this(views) } - addView(view: View) { + addView(table: TableDo, view: View) { if (!this.views.length) { const json = view.toJSON() - const defaultView = ViewFactory.fromJSON({ ...json, isDefault: true }) + const defaultView = ViewFactory.fromJSON(table, { ...json, isDefault: true }) return new Views([defaultView]) } return new Views([...this.views, view]) @@ -83,19 +84,19 @@ export class Views extends ValueObject { return new Views(this.views.filter((v) => !v.id.equals(view.id))) } - $addField(field: Field) { - const specs = this.views.map((view) => view.$addField(field)) + $addField(table: TableDo, field: Field) { + const specs = this.views.map((view) => view.$addField(table, field)) return andOptions(...specs) } - $deleteField(field: Field) { - const specs = this.views.map((view) => view.$deleteField(field)) + $deleteField(table: TableDo, field: Field) { + const specs = this.views.map((view) => view.$deleteField(table, field)) return andOptions(...specs) } - $setDefaultView(dto: ISetDefaultViewDTO): Option { + $setDefaultView(table: TableDo, dto: ISetDefaultViewDTO): Option { const defaultView = this.getDefaultView() if (defaultView.id.value === dto.viewId) { return None @@ -104,13 +105,13 @@ export class Views extends ValueObject { const view = this.getViewById(dto.viewId) const defaultViewSpec = new WithView( - ViewFactory.fromJSON(defaultView.toJSON()), - ViewFactory.fromJSON({ ...defaultView.toJSON(), isDefault: false }), + ViewFactory.fromJSON(table, defaultView.toJSON()), + ViewFactory.fromJSON(table, { ...defaultView.toJSON(), isDefault: false }), ) const viewSpec = new WithView( - ViewFactory.fromJSON(view.toJSON()), - ViewFactory.fromJSON({ ...view.toJSON(), isDefault: true }), + ViewFactory.fromJSON(table, view.toJSON()), + ViewFactory.fromJSON(table, { ...view.toJSON(), isDefault: true }), ) return and(defaultViewSpec, viewSpec) diff --git a/packages/table/src/specifications/table-view.specification.ts b/packages/table/src/specifications/table-view.specification.ts index 8a4cff1bf..f37a015e5 100644 --- a/packages/table/src/specifications/table-view.specification.ts +++ b/packages/table/src/specifications/table-view.specification.ts @@ -1,5 +1,5 @@ -import { Ok,Option,WontImplementException,type Result } from "@undb/domain" -import type { FieldId,IRootViewFilter,View,ViewId } from "../modules" +import { Ok, Option, WontImplementException, type Result } from "@undb/domain" +import type { FieldId, IRootViewFilter, View, ViewId } from "../modules" import type { IViewAggregate } from "../modules/views/view/view-aggregate/view-aggregate.vo" import type { IRootViewColor } from "../modules/views/view/view-color" import type { IViewFields } from "../modules/views/view/view-fields" @@ -59,7 +59,7 @@ export class WithNewView extends TableComositeSpecification { throw new WontImplementException(TableComositeSpecification.name + ".isSatisfiedBy") } mutate(t: TableDo): Result { - t.views = t.views.addView(this.view) + t.views = t.views.addView(t, this.view) return Ok(t) } accept(v: ITableSpecVisitor): Result { @@ -186,7 +186,7 @@ export class WithViewFields extends TableComositeSpecification { } mutate(t: TableDo): Result { const view = t.views.getViewById(this.viewId.value) - view.setFields(this.fields) + view.setFields(t, this.fields) return Ok(t) } accept(v: ITableSpecVisitor): Result { @@ -224,7 +224,7 @@ export class WithViewFieldWidth extends TableComositeSpecification { } mutate(t: TableDo): Result { const view = t.views.getViewById(this.viewId.value) - if (view.type === 'grid') { + if (view.type === "grid") { view.setFieldWidth(this.fieldId.value, this.width) } return Ok(t) diff --git a/packages/table/src/table.builder.ts b/packages/table/src/table.builder.ts index d22b990d6..7a0376a3e 100644 --- a/packages/table/src/table.builder.ts +++ b/packages/table/src/table.builder.ts @@ -90,12 +90,12 @@ export class TableBuilder implements ITableBuilder { } createViews(dto?: ICreateViewDTO[]): ITableBuilder { - new TableViewsSpecification(Views.create(dto)).mutate(this.table) + new TableViewsSpecification(Views.create(this.table, dto)).mutate(this.table) return this } setViews(dto: IViewsDTO): ITableBuilder { - new TableViewsSpecification(Views.fromJSON(dto)).mutate(this.table) + new TableViewsSpecification(Views.fromJSON(this.table, dto)).mutate(this.table) return this } diff --git a/packages/template/src/template.factory.ts b/packages/template/src/template.factory.ts index 93cf5fc23..c3decd308 100644 --- a/packages/template/src/template.factory.ts +++ b/packages/template/src/template.factory.ts @@ -43,7 +43,6 @@ export class TemplateFactory { name, })) as ICreateFormDTO[] - console.log(table.records) const records = table.records?.map((record: IFlattenCreateRecordDTO) => flattenToCreateRecordDTO(record)) return { diff --git a/packages/template/src/templates/projectManagement.base.json b/packages/template/src/templates/projectManagement.base.json index 3b639294c..dea50dce4 100644 --- a/packages/template/src/templates/projectManagement.base.json +++ b/packages/template/src/templates/projectManagement.base.json @@ -662,6 +662,10 @@ }, "Done": { "type": "grid", + "fields": [{ "fieldId": "status", "hidden": true }], + "option": { + "showSystemFields": true + }, "filter": { "conjunction": "and", "children": [ From f29ee1e818c8d593c7cda91a6cff8cda7d7de6ed Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 11:22:16 +0800 Subject: [PATCH 05/16] doc: project manage ment base --- .../src/templates/projectManagement.base.json | 916 +++++++----------- 1 file changed, 375 insertions(+), 541 deletions(-) diff --git a/packages/template/src/templates/projectManagement.base.json b/packages/template/src/templates/projectManagement.base.json index dea50dce4..28cbde8fc 100644 --- a/packages/template/src/templates/projectManagement.base.json +++ b/packages/template/src/templates/projectManagement.base.json @@ -172,406 +172,6 @@ "id": "project-20", "Title": "Intelligent Warehouse Management Solution", "Due Date": "2024-06-30" - }, - { - "id": "project-21", - "Title": "Augmented Reality Navigation App", - "Due Date": "2024-09-15" - }, - { - "id": "project-22", - "Title": "Smart Home Voice Control System", - "Due Date": "2024-07-31" - }, - { - "id": "project-23", - "Title": "Blockchain Digital Identity Verification", - "Due Date": "2024-11-15" - }, - { - "id": "project-24", - "Title": "AI Image Recognition System", - "Due Date": "2024-08-31" - }, - { - "id": "project-25", - "Title": "Intelligent Energy Management Platform", - "Due Date": "2024-05-31" - }, - { - "id": "project-26", - "Title": "Machine Learning Predictive Analytics Tool", - "Due Date": "2024-10-31" - }, - { - "id": "project-27", - "Title": "IoT Smart Waste Sorting System", - "Due Date": "2024-07-15" - }, - { - "id": "project-28", - "Title": "Cloud Computing Resource Scheduling Platform", - "Due Date": "2024-09-30" - }, - { - "id": "project-29", - "Title": "Smart Manufacturing Production Line Optimization", - "Due Date": "2024-12-15" - }, - { - "id": "project-30", - "Title": "Network Security Threat Detection System", - "Due Date": "2024-06-15" - }, - { - "id": "project-31", - "Title": "Intelligent Building Energy Management", - "Due Date": "2024-08-15" - }, - { - "id": "project-32", - "Title": "Blockchain Electronic Voting System", - "Due Date": "2024-11-30" - }, - { - "id": "project-33", - "Title": "AI Natural Language Processing Platform", - "Due Date": "2024-07-31" - }, - { - "id": "project-34", - "Title": "Intelligent Traffic Signal Control System", - "Due Date": "2024-10-15" - }, - { - "id": "project-35", - "Title": "Virtual Reality Training Simulator", - "Due Date": "2024-09-15" - }, - { - "id": "project-36", - "Title": "Big Data Customer Behavior Analysis Platform", - "Due Date": "2024-12-31" - }, - { - "id": "project-37", - "Title": "Smart Water Resource Management System", - "Due Date": "2024-08-31" - }, - { - "id": "project-38", - "Title": "Blockchain Digital Copyright Protection", - "Due Date": "2024-11-15" - }, - { - "id": "project-39", - "Title": "AI Recommendation Engine Development", - "Due Date": "2024-10-31" - }, - { - "id": "project-40", - "Title": "Smart Home Security Monitoring System", - "Due Date": "2024-07-15" - }, - { - "id": "project-41", - "Title": "Cloud-Native Application Development Platform", - "Due Date": "2024-09-30" - }, - { - "id": "project-42", - "Title": "IoT Smart Parking Management", - "Due Date": "2024-06-30" - }, - { - "id": "project-43", - "Title": "Robotic Process Automation Tool", - "Due Date": "2024-08-15" - }, - { - "id": "project-44", - "Title": "Intelligent Environmental Monitoring System", - "Due Date": "2024-11-30" - }, - { - "id": "project-45", - "Title": "Blockchain Cross-Border Payment Platform", - "Due Date": "2024-10-15" - }, - { - "id": "project-46", - "Title": "AI Sentiment Analysis System", - "Due Date": "2024-07-31" - }, - { - "id": "project-47", - "Title": "Smart Factory Production Scheduling Platform", - "Due Date": "2024-09-15" - }, - { - "id": "project-48", - "Title": "Augmented Reality Remote Collaboration Tool", - "Due Date": "2024-12-15" - }, - { - "id": "project-49", - "Title": "Big Data Risk Assessment Model", - "Due Date": "2024-11-15" - }, - { - "id": "project-50", - "Title": "Smart Grid Management System", - "Due Date": "2024-08-31" - }, - { - "id": "project-51", - "Title": "Blockchain Traceability Platform Development", - "Due Date": "2024-10-31" - }, - { - "id": "project-52", - "Title": "AI Video Analysis System", - "Due Date": "2024-09-30" - }, - { - "id": "project-53", - "Title": "Smart Home Energy Management Platform", - "Due Date": "2024-07-15" - }, - { - "id": "project-54", - "Title": "Cloud Security Solution", - "Due Date": "2024-11-30" - }, - { - "id": "project-55", - "Title": "IoT Asset Tracking System", - "Due Date": "2024-08-15" - }, - { - "id": "project-56", - "Title": "Machine Learning Anomaly Detection Tool", - "Due Date": "2024-10-15" - }, - { - "id": "project-57", - "Title": "Smart City Waste Management Platform", - "Due Date": "2024-12-31" - }, - { - "id": "project-58", - "Title": "Blockchain Smart Contract Platform", - "Due Date": "2024-09-15" - }, - { - "id": "project-59", - "Title": "AI Medical Image Analysis", - "Due Date": "2024-11-15" - }, - { - "id": "project-60", - "Title": "Intelligent Logistics Delivery System", - "Due Date": "2024-07-31" - }, - { - "id": "project-61", - "Title": "Virtual Reality Social Platform", - "Due Date": "2024-10-31" - }, - { - "id": "project-62", - "Title": "Big Data Predictive Maintenance System", - "Due Date": "2024-08-31" - }, - { - "id": "project-63", - "Title": "Smart Agriculture Irrigation Management", - "Due Date": "2024-06-30" - }, - { - "id": "project-64", - "Title": "Blockchain Digital Asset Exchange Platform", - "Due Date": "2024-09-30" - }, - { - "id": "project-65", - "Title": "AI Chatbot Development", - "Due Date": "2024-07-15" - }, - { - "id": "project-66", - "Title": "Smart Home Health Monitoring System", - "Due Date": "2024-11-30" - }, - { - "id": "project-67", - "Title": "Cloud Gaming Streaming Platform", - "Due Date": "2024-10-15" - }, - { - "id": "project-68", - "Title": "IoT Smart Lighting Control", - "Due Date": "2024-08-15" - }, - { - "id": "project-69", - "Title": "Robotic Process Automation Platform", - "Due Date": "2024-12-15" - }, - { - "id": "project-70", - "Title": "Smart City Air Quality Monitoring", - "Due Date": "2024-09-15" - }, - { - "id": "project-71", - "Title": "Blockchain-based Supply Chain Financing", - "Due Date": "2024-11-15" - }, - { - "id": "project-72", - "Title": "AI-powered Fraud Detection System", - "Due Date": "2024-07-31" - }, - { - "id": "project-73", - "Title": "Smart Traffic Congestion Management", - "Due Date": "2024-10-31" - }, - { - "id": "project-74", - "Title": "Augmented Reality Retail Experience", - "Due Date": "2024-08-31" - }, - { - "id": "project-75", - "Title": "IoT-based Precision Agriculture System", - "Due Date": "2024-06-30" - }, - { - "id": "project-76", - "Title": "Quantum Computing Simulation Platform", - "Due Date": "2024-12-31" - }, - { - "id": "project-77", - "Title": "AI-driven Customer Segmentation Tool", - "Due Date": "2024-09-30" - }, - { - "id": "project-78", - "Title": "Smart City Emergency Response System", - "Due Date": "2024-11-30" - }, - { - "id": "project-79", - "Title": "Blockchain-based Voting System", - "Due Date": "2024-10-15" - }, - { - "id": "project-80", - "Title": "Virtual Reality Therapy Platform", - "Due Date": "2024-08-15" - }, - { - "id": "project-81", - "Title": "IoT-enabled Smart Office Solution", - "Due Date": "2024-07-15" - }, - { - "id": "project-82", - "Title": "AI-powered Personal Finance Assistant", - "Due Date": "2024-09-15" - }, - { - "id": "project-83", - "Title": "Drone Delivery Management System", - "Due Date": "2024-11-15" - }, - { - "id": "project-84", - "Title": "Blockchain-based Healthcare Data Exchange", - "Due Date": "2024-12-15" - }, - { - "id": "project-85", - "Title": "Smart City Noise Pollution Monitoring", - "Due Date": "2024-10-31" - }, - { - "id": "project-86", - "Title": "AI-driven HR Recruitment Platform", - "Due Date": "2024-08-31" - }, - { - "id": "project-87", - "Title": "IoT Fleet Management System", - "Due Date": "2024-07-31" - }, - { - "id": "project-88", - "Title": "Augmented Reality Maintenance Guide", - "Due Date": "2024-09-30" - }, - { - "id": "project-89", - "Title": "Blockchain-based Charity Donation Platform", - "Due Date": "2024-11-30" - }, - { - "id": "project-90", - "Title": "Smart Home Elderly Care System", - "Due Date": "2024-10-15" - }, - { - "id": "project-91", - "Title": "AI-powered Legal Document Analysis", - "Due Date": "2024-08-15" - }, - { - "id": "project-92", - "Title": "IoT-based Smart Irrigation System", - "Due Date": "2024-06-30" - }, - { - "id": "project-93", - "Title": "Blockchain Digital Identity Management", - "Due Date": "2024-12-31" - }, - { - "id": "project-94", - "Title": "Virtual Reality Real Estate Tour Platform", - "Due Date": "2024-11-15" - }, - { - "id": "project-95", - "Title": "AI-driven Predictive Maintenance for Industry", - "Due Date": "2024-09-15" - }, - { - "id": "project-96", - "Title": "Smart City Traffic Light Optimization", - "Due Date": "2024-07-15" - }, - { - "id": "project-97", - "Title": "IoT-based Smart Waste Collection", - "Due Date": "2024-10-31" - }, - { - "id": "project-98", - "Title": "Blockchain-based Intellectual Property Registry", - "Due Date": "2024-08-31" - }, - { - "id": "project-99", - "Title": "AI Language Translation Platform", - "Due Date": "2024-11-30" - }, - { - "id": "project-100", - "Title": "Smart Building Management System", - "Due Date": "2024-12-15" } ] }, @@ -831,847 +431,1081 @@ "id": "bug-21", "Title": "AR navigation app GPS drift in urban areas", "Status": "backlog", - "Projects": ["project-21"] + "Projects": ["project-20"] }, { "id": "bug-22", "Title": "Voice control system misinterpreting commands", "Status": "inProgress", - "Projects": ["project-22"] + "Projects": ["project-1"] }, { "id": "bug-23", "Title": "Blockchain identity verification timeout", "Status": "done", - "Projects": ["project-23"] + "Projects": ["project-2"] }, { "id": "bug-24", "Title": "AI image recognition false negatives", "Status": "inProgress", - "Projects": ["project-24"] + "Projects": ["project-3"] }, { "id": "bug-25", "Title": "Energy consumption prediction algorithm inaccuracy", "Status": "backlog", - "Projects": ["project-25"] + "Projects": ["project-4"] }, { "id": "bug-26", "Title": "Machine learning model overfitting on test data", "Status": "inProgress", - "Projects": ["project-26"] + "Projects": ["project-5"] }, { "id": "bug-27", "Title": "IoT waste sorting system misclassification", "Status": "backlog", - "Projects": ["project-27"] + "Projects": ["project-6"] }, { "id": "bug-28", "Title": "Cloud resource allocation inefficiency", "Status": "inProgress", - "Projects": ["project-28"] + "Projects": ["project-7"] }, { "id": "bug-29", "Title": "Smart manufacturing line unexpected shutdowns", "Status": "done", - "Projects": ["project-29"] + "Projects": ["project-8"] }, { "id": "bug-30", "Title": "Network intrusion detection false alarms", "Status": "inProgress", - "Projects": ["project-30"] + "Projects": ["project-9"] }, { "id": "bug-31", "Title": "Building HVAC system energy waste", "Status": "backlog", - "Projects": ["project-31"] + "Projects": ["project-10"] }, { "id": "bug-32", "Title": "Blockchain voting system double-voting vulnerability", "Status": "inProgress", - "Projects": ["project-32"] + "Projects": ["project-11"] }, { "id": "bug-33", "Title": "NLP model misunderstanding context in conversations", "Status": "backlog", - "Projects": ["project-33"] + "Projects": ["project-12"] }, { "id": "bug-34", "Title": "Traffic signal optimization causing congestion", "Status": "inProgress", - "Projects": ["project-34"] + "Projects": ["project-13"] }, { "id": "bug-35", "Title": "VR training simulator causing disorientation", "Status": "done", - "Projects": ["project-35"] + "Projects": ["project-14"] }, { "id": "bug-36", "Title": "Customer behavior prediction model bias", "Status": "inProgress", - "Projects": ["project-36"] + "Projects": ["project-15"] }, { "id": "bug-37", "Title": "Smart water meter reading inaccuracies", "Status": "backlog", - "Projects": ["project-37"] + "Projects": ["project-16"] }, { "id": "bug-38", "Title": "Digital copyright protection system bypass", "Status": "inProgress", - "Projects": ["project-38"] + "Projects": ["project-17"] }, { "id": "bug-39", "Title": "AI recommendation engine suggesting irrelevant items", "Status": "backlog", - "Projects": ["project-39"] + "Projects": ["project-18"] }, { "id": "bug-40", "Title": "Home security system false alarms", "Status": "inProgress", - "Projects": ["project-40"] + "Projects": ["project-19"] }, { "id": "bug-41", "Title": "Cloud-native app scaling issues under high load", "Status": "backlog", - "Projects": ["project-41"] + "Projects": ["project-20"] }, { "id": "bug-42", "Title": "Smart parking system incorrect space availability", "Status": "inProgress", - "Projects": ["project-42"] + "Projects": ["project-20"] }, { "id": "bug-43", "Title": "RPA tool failing to handle exceptions", "Status": "done", - "Projects": ["project-43"] + "Projects": ["project-1"] }, { "id": "bug-44", "Title": "Environmental sensor calibration drift", "Status": "inProgress", - "Projects": ["project-44"] + "Projects": ["project-2"] }, { "id": "bug-45", "Title": "Blockchain payment system double-spending vulnerability", "Status": "backlog", - "Projects": ["project-45"] + "Projects": ["project-3"] }, { "id": "bug-46", "Title": "AI sentiment analysis misinterpreting sarcasm", "Status": "inProgress", - "Projects": ["project-46"] + "Projects": ["project-4"] }, { "id": "bug-47", "Title": "Smart home system unresponsive to voice commands", "Status": "backlog", - "Projects": ["project-1"] + "Projects": ["project-5"] }, { "id": "bug-48", "Title": "E-commerce platform search results irrelevance", "Status": "inProgress", - "Projects": ["project-2"] + "Projects": ["project-6"] }, { "id": "bug-49", "Title": "Mobile payment app transaction failure", "Status": "done", - "Projects": ["project-3"] + "Projects": ["project-7"] }, { "id": "bug-50", "Title": "AI chatbot providing incorrect information", "Status": "inProgress", - "Projects": ["project-4"] + "Projects": ["project-8"] }, { "id": "bug-51", "Title": "Cloud storage data corruption during transfer", "Status": "backlog", - "Projects": ["project-5"] + "Projects": ["project-9"] }, { "id": "bug-52", "Title": "Blockchain supply chain tracking inconsistencies", "Status": "inProgress", - "Projects": ["project-6"] + "Projects": ["project-10"] }, { "id": "bug-53", "Title": "VR education platform causing eye strain", "Status": "backlog", - "Projects": ["project-7"] + "Projects": ["project-11"] }, { "id": "bug-54", "Title": "IoT vehicle tracking system location inaccuracy", "Status": "inProgress", - "Projects": ["project-8"] + "Projects": ["project-12"] }, { "id": "bug-55", "Title": "Big data analytics tool memory leak", "Status": "done", - "Projects": ["project-9"] + "Projects": ["project-13"] }, { "id": "bug-56", "Title": "Cybersecurity system failing to detect new threats", "Status": "inProgress", - "Projects": ["project-10"] + "Projects": ["project-14"] }, { "id": "bug-57", "Title": "Medical diagnosis AI misclassifying rare conditions", "Status": "backlog", - "Projects": ["project-11"] + "Projects": ["project-15"] }, { "id": "bug-58", "Title": "Renewable energy forecasting model inaccuracy", "Status": "inProgress", - "Projects": ["project-12"] + "Projects": ["project-16"] }, { "id": "bug-59", "Title": "Facial recognition system privacy concerns", "Status": "backlog", - "Projects": ["project-13"] + "Projects": ["project-17"] }, { "id": "bug-60", "Title": "Smart city traffic management causing gridlock", "Status": "inProgress", - "Projects": ["project-14"] + "Projects": ["project-18"] }, { "id": "bug-61", "Title": "Online education platform quiz grading errors", "Status": "done", - "Projects": ["project-15"] + "Projects": ["project-19"] }, { "id": "bug-62", "Title": "Social media data analysis privacy breach", "Status": "inProgress", - "Projects": ["project-16"] + "Projects": ["project-20"] }, { "id": "bug-63", "Title": "Smart agriculture system overwatering crops", "Status": "backlog", - "Projects": ["project-17"] + "Projects": ["project-20"] }, { "id": "bug-64", "Title": "Telemedicine platform data encryption weakness", "Status": "inProgress", - "Projects": ["project-18"] + "Projects": ["project-1"] }, { "id": "bug-65", "Title": "ERP system financial reporting discrepancies", "Status": "backlog", - "Projects": ["project-19"] + "Projects": ["project-2"] }, { "id": "bug-66", "Title": "Warehouse management AI misplacing inventory", "Status": "inProgress", - "Projects": ["project-20"] + "Projects": ["project-3"] }, { "id": "bug-67", "Title": "AR navigation app battery drain issue", "Status": "done", - "Projects": ["project-21"] + "Projects": ["project-4"] }, { "id": "bug-68", "Title": "Smart home voice control system security vulnerability", "Status": "inProgress", - "Projects": ["project-22"] + "Projects": ["project-5"] }, { "id": "bug-69", "Title": "Blockchain identity verification data leak", "Status": "backlog", - "Projects": ["project-23"] + "Projects": ["project-6"] }, { "id": "bug-70", "Title": "AI image recognition system bias", "Status": "inProgress", - "Projects": ["project-24"] + "Projects": ["project-7"] }, { "id": "bug-71", "Title": "Energy management platform causing power outages", "Status": "backlog", - "Projects": ["project-25"] + "Projects": ["project-8"] }, { "id": "bug-72", "Title": "Machine learning model performance degradation over time", "Status": "inProgress", - "Projects": ["project-26"] + "Projects": ["project-9"] }, { "id": "bug-73", "Title": "IoT waste sorting system contamination issues", "Status": "done", - "Projects": ["project-27"] + "Projects": ["project-10"] }, { "id": "bug-74", "Title": "Cloud computing resource over-allocation", "Status": "inProgress", - "Projects": ["project-28"] + "Projects": ["project-11"] }, { "id": "bug-75", "Title": "Smart manufacturing quality control false negatives", "Status": "backlog", - "Projects": ["project-29"] + "Projects": ["project-12"] }, { "id": "bug-76", "Title": "Network security system performance bottleneck", "Status": "inProgress", - "Projects": ["project-30"] + "Projects": ["project-13"] }, { "id": "bug-77", "Title": "Building energy management system sensor failures", "Status": "backlog", - "Projects": ["project-31"] + "Projects": ["project-14"] }, { "id": "bug-78", "Title": "Blockchain voting system audit trail gaps", "Status": "inProgress", - "Projects": ["project-32"] + "Projects": ["project-15"] }, { "id": "bug-79", "Title": "NLP model struggling with multilingual input", "Status": "done", - "Projects": ["project-33"] + "Projects": ["project-16"] }, { "id": "bug-80", "Title": "Intelligent traffic control causing pedestrian delays", "Status": "inProgress", - "Projects": ["project-34"] + "Projects": ["project-17"] }, { "id": "bug-81", "Title": "VR training simulator graphics rendering issues", "Status": "backlog", - "Projects": ["project-35"] + "Projects": ["project-18"] }, { "id": "bug-82", "Title": "Customer behavior analysis privacy concerns", "Status": "inProgress", - "Projects": ["project-36"] + "Projects": ["project-19"] }, { "id": "bug-83", "Title": "Smart water management system leak detection failures", "Status": "backlog", - "Projects": ["project-37"] + "Projects": ["project-20"] }, { "id": "bug-84", "Title": "Blockchain copyright system content fingerprinting errors", "Status": "inProgress", - "Projects": ["project-38"] + "Projects": ["project-20"] }, { "id": "bug-85", "Title": "AI recommendation engine filter bubble effect", "Status": "done", - "Projects": ["project-39"] + "Projects": ["project-1"] }, { "id": "bug-86", "Title": "Smart home security system camera blind spots", "Status": "inProgress", - "Projects": ["project-40"] + "Projects": ["project-2"] }, { "id": "bug-87", "Title": "Cloud-native app container orchestration failures", "Status": "backlog", - "Projects": ["project-41"] + "Projects": ["project-3"] }, { "id": "bug-88", "Title": "IoT parking management payment processing errors", "Status": "inProgress", - "Projects": ["project-42"] + "Projects": ["project-4"] }, { "id": "bug-89", "Title": "RPA tool incompatibility with legacy systems", "Status": "backlog", - "Projects": ["project-43"] + "Projects": ["project-5"] }, { "id": "bug-90", "Title": "Environmental monitoring system data transmission delays", "Status": "inProgress", - "Projects": ["project-44"] + "Projects": ["project-6"] }, { "id": "bug-91", "Title": "Blockchain payment system transaction reversal issues", "Status": "done", - "Projects": ["project-45"] + "Projects": ["project-7"] }, { "id": "bug-92", "Title": "AI sentiment analysis struggling with context", "Status": "inProgress", - "Projects": ["project-46"] + "Projects": ["project-8"] }, { "id": "bug-93", "Title": "Smart home system integration conflicts", "Status": "backlog", - "Projects": ["project-1"] + "Projects": ["project-9"] }, { "id": "bug-94", "Title": "E-commerce platform product recommendation irrelevance", "Status": "inProgress", - "Projects": ["project-2"] + "Projects": ["project-10"] }, { "id": "bug-95", "Title": "Mobile payment app security vulnerabilities", "Status": "backlog", - "Projects": ["project-3"] + "Projects": ["project-11"] }, { "id": "bug-96", "Title": "AI customer service system language model hallucinations", "Status": "inProgress", - "Projects": ["project-4"] + "Projects": ["project-12"] }, { "id": "bug-97", "Title": "Cloud storage system data retrieval latency", "Status": "done", - "Projects": ["project-5"] + "Projects": ["project-13"] }, { "id": "bug-98", "Title": "Blockchain supply chain product authenticity verification failures", "Status": "inProgress", - "Projects": ["project-6"] + "Projects": ["project-14"] }, { "id": "bug-99", "Title": "VR education platform content loading issues", "Status": "backlog", - "Projects": ["project-7"] + "Projects": ["project-15"] }, { "id": "bug-100", "Title": "IoT vehicle tracking battery life optimization needed", "Status": "inProgress", - "Projects": ["project-8"] + "Projects": ["project-16"] }, { "id": "bug-101", "Title": "Big data analytics tool query performance issues", "Status": "backlog", - "Projects": ["project-9"] + "Projects": ["project-17"] }, { "id": "bug-102", "Title": "Cybersecurity system update deployment failures", "Status": "inProgress", - "Projects": ["project-10"] + "Projects": ["project-18"] }, { "id": "bug-103", "Title": "Medical diagnosis AI explainability concerns", "Status": "done", - "Projects": ["project-11"] + "Projects": ["project-19"] }, { "id": "bug-104", "Title": "Renewable energy management load balancing issues", "Status": "inProgress", - "Projects": ["project-12"] + "Projects": ["project-20"] }, { "id": "bug-105", "Title": "Facial recognition access control tailgating vulnerability", "Status": "backlog", - "Projects": ["project-13"] + "Projects": ["project-20"] }, { "id": "bug-106", "Title": "Smart city traffic management emergency vehicle prioritization failures", "Status": "inProgress", - "Projects": ["project-14"] + "Projects": ["project-1"] }, { "id": "bug-107", "Title": "Online education course content version control issues", "Status": "backlog", - "Projects": ["project-15"] + "Projects": ["project-2"] }, { "id": "bug-108", "Title": "Social media data analysis tool API rate limiting", "Status": "inProgress", - "Projects": ["project-16"] + "Projects": ["project-3"] }, { "id": "bug-109", "Title": "Smart agriculture pest detection false positives", "Status": "done", - "Projects": ["project-17"] + "Projects": ["project-4"] }, { "id": "bug-110", "Title": "Telemedicine platform video quality degradation", "Status": "inProgress", - "Projects": ["project-18"] + "Projects": ["project-5"] }, { "id": "bug-111", "Title": "ERP system module integration conflicts", "Status": "backlog", - "Projects": ["project-19"] + "Projects": ["project-6"] }, { "id": "bug-112", "Title": "Intelligent warehouse management system picking errors", "Status": "inProgress", - "Projects": ["project-20"] + "Projects": ["project-7"] }, { "id": "bug-113", "Title": "AR navigation app landmark recognition failures", "Status": "backlog", - "Projects": ["project-21"] + "Projects": ["project-8"] }, { "id": "bug-114", "Title": "Smart home voice control wake word false activations", "Status": "inProgress", - "Projects": ["project-22"] + "Projects": ["project-9"] }, { "id": "bug-115", "Title": "Blockchain digital identity system user onboarding friction", "Status": "done", - "Projects": ["project-23"] + "Projects": ["project-10"] }, { "id": "bug-116", "Title": "AI image recognition system adversarial attack vulnerability", "Status": "inProgress", - "Projects": ["project-24"] + "Projects": ["project-11"] }, { "id": "bug-117", "Title": "Intelligent energy management demand forecasting inaccuracies", "Status": "backlog", - "Projects": ["project-25"] + "Projects": ["project-12"] }, { "id": "bug-118", "Title": "Machine learning predictive maintenance false alarms", "Status": "inProgress", - "Projects": ["project-26"] + "Projects": ["project-13"] }, { "id": "bug-119", "Title": "IoT smart waste sorting system sensor malfunctions", "Status": "backlog", - "Projects": ["project-27"] + "Projects": ["project-14"] }, { "id": "bug-120", "Title": "Cloud computing resource scheduling inefficiencies", "Status": "inProgress", - "Projects": ["project-28"] + "Projects": ["project-15"] }, { "id": "bug-121", "Title": "Smart manufacturing production line bottleneck detection failures", "Status": "done", - "Projects": ["project-29"] + "Projects": ["project-16"] }, { "id": "bug-122", "Title": "Network security threat intelligence feed integration issues", "Status": "inProgress", - "Projects": ["project-30"] + "Projects": ["project-17"] }, { "id": "bug-123", "Title": "Intelligent building management system HVAC control instability", "Status": "backlog", - "Projects": ["project-31"] + "Projects": ["project-18"] }, { "id": "bug-124", "Title": "Blockchain electronic voting system voter authentication challenges", "Status": "inProgress", - "Projects": ["project-32"] + "Projects": ["project-19"] }, { "id": "bug-125", "Title": "AI natural language processing model bias in translations", "Status": "backlog", - "Projects": ["project-33"] + "Projects": ["project-20"] }, { "id": "bug-126", "Title": "Intelligent traffic signal control system pedestrian safety concerns", "Status": "inProgress", - "Projects": ["project-34"] + "Projects": ["project-20"] }, { "id": "bug-127", "Title": "VR training simulator motion tracking latency", "Status": "done", - "Projects": ["project-35"] + "Projects": ["project-1"] }, { "id": "bug-128", "Title": "Big data customer behavior analysis data quality issues", "Status": "inProgress", - "Projects": ["project-36"] + "Projects": ["project-2"] }, { "id": "bug-129", "Title": "Smart water resource management system pipe burst detection delays", "Status": "backlog", - "Projects": ["project-37"] + "Projects": ["project-3"] }, { "id": "bug-130", "Title": "Blockchain digital copyright protection content piracy vulnerabilities", "Status": "inProgress", - "Projects": ["project-38"] + "Projects": ["project-4"] }, { "id": "bug-131", "Title": "AI recommendation engine cold start problem for new users", "Status": "backlog", - "Projects": ["project-39"] + "Projects": ["project-5"] }, { "id": "bug-132", "Title": "Smart home security monitoring false alarm rate", "Status": "inProgress", - "Projects": ["project-40"] + "Projects": ["project-6"] }, { "id": "bug-133", "Title": "Cloud-native application development CI/CD pipeline failures", "Status": "done", - "Projects": ["project-41"] + "Projects": ["project-7"] }, { "id": "bug-134", "Title": "IoT smart parking occupancy sensor accuracy issues", "Status": "inProgress", - "Projects": ["project-42"] + "Projects": ["project-8"] }, { "id": "bug-135", "Title": "Robotic process automation script maintenance challenges", "Status": "backlog", - "Projects": ["project-43"] + "Projects": ["project-9"] }, { "id": "bug-136", "Title": "Intelligent environmental monitoring system data interpolation errors", "Status": "inProgress", - "Projects": ["project-44"] + "Projects": ["project-10"] }, { "id": "bug-137", "Title": "Blockchain cross-border payment system regulatory compliance issues", "Status": "backlog", - "Projects": ["project-45"] + "Projects": ["project-11"] }, { "id": "bug-138", "Title": "AI sentiment analysis system struggling with emojis and slang", "Status": "inProgress", - "Projects": ["project-46"] + "Projects": ["project-12"] }, { "id": "bug-139", "Title": "Smart home system device compatibility issues", "Status": "done", - "Projects": ["project-1"] + "Projects": ["project-13"] }, { "id": "bug-140", "Title": "E-commerce platform inventory synchronization delays", "Status": "inProgress", - "Projects": ["project-2"] + "Projects": ["project-14"] }, { "id": "bug-141", "Title": "Mobile payment app cross-platform consistency issues", "Status": "backlog", - "Projects": ["project-3"] + "Projects": ["project-15"] }, { "id": "bug-142", "Title": "AI customer service chatbot context retention problems", "Status": "inProgress", - "Projects": ["project-4"] + "Projects": ["project-16"] }, { "id": "bug-143", "Title": "Cloud storage system data deduplication inefficiencies", "Status": "backlog", - "Projects": ["project-5"] + "Projects": ["project-17"] }, { "id": "bug-144", "Title": "Blockchain supply chain management system scalability limitations", "Status": "inProgress", - "Projects": ["project-6"] + "Projects": ["project-18"] }, { "id": "bug-145", "Title": "VR education platform user interface accessibility issues", "Status": "done", - "Projects": ["project-7"] + "Projects": ["project-19"] }, { "id": "bug-146", "Title": "IoT vehicle tracking system cellular network coverage gaps", "Status": "inProgress", - "Projects": ["project-8"] + "Projects": ["project-20"] }, { "id": "bug-147", "Title": "Big data analytics tool data visualization rendering issues", "Status": "backlog", - "Projects": ["project-9"] + "Projects": ["project-20"] }, { "id": "bug-148", "Title": "Cybersecurity enhancement system false positive rate", "Status": "inProgress", - "Projects": ["project-10"] + "Projects": ["project-1"] }, { "id": "bug-149", "Title": "Medical diagnosis AI system integration with EHR challenges", "Status": "backlog", - "Projects": ["project-11"] + "Projects": ["project-2"] }, { "id": "bug-150", "Title": "Renewable energy management platform grid stability issues", "Status": "inProgress", - "Projects": ["project-12"] + "Projects": ["project-3"] }, { "id": "bug-151", "Title": "Facial recognition access control system performance in varying lighting", "Status": "done", - "Projects": ["project-13"] + "Projects": ["project-4"] }, { "id": "bug-152", "Title": "Smart city traffic management system sensor data inconsistencies", "Status": "inProgress", - "Projects": ["project-14"] + "Projects": ["project-5"] }, { "id": "bug-153", "Title": "Online education course platform user engagement tracking inaccuracies", "Status": "backlog", - "Projects": ["project-15"] + "Projects": ["project-6"] }, { "id": "bug-154", "Title": "Social media data analysis tool data normalization issues", "Status": "inProgress", - "Projects": ["project-16"] + "Projects": ["project-7"] }, { "id": "bug-155", "Title": "Smart agriculture monitoring system weather data integration challenges", "Status": "backlog", - "Projects": ["project-17"] + "Projects": ["project-8"] }, { "id": "bug-156", "Title": "Telemedicine consultation platform scheduling conflicts", "Status": "inProgress", - "Projects": ["project-18"] + "Projects": ["project-9"] }, { "id": "bug-157", "Title": "ERP system upgrade data migration errors", "Status": "done", - "Projects": ["project-19"] + "Projects": ["project-10"] }, { "id": "bug-158", "Title": "Intelligent warehouse management solution inventory discrepancies", "Status": "inProgress", - "Projects": ["project-20"] + "Projects": ["project-11"] }, { "id": "bug-159", "Title": "AR navigation app POI database update delays", "Status": "backlog", - "Projects": ["project-21"] + "Projects": ["project-12"] }, { "id": "bug-160", "Title": "Smart home voice control system multi-language support issues", "Status": "inProgress", - "Projects": ["project-22"] + "Projects": ["project-13"] }, { "id": "bug-161", "Title": "Blockchain digital identity verification system performance bottlenecks", "Status": "backlog", - "Projects": ["project-23"] + "Projects": ["project-14"] + }, + { + "id": "bug-162", + "Title": "VR education platform content loading issues", + "Status": "inProgress", + "Projects": ["project-15"] + }, + { + "id": "bug-163", + "Title": "IoT vehicle tracking system battery life optimization needed", + "Status": "backlog", + "Projects": ["project-16"] + }, + { + "id": "bug-164", + "Title": "Big data analytics tool query performance issues", + "Status": "inProgress", + "Projects": ["project-17"] + }, + { + "id": "bug-165", + "Title": "Cybersecurity system update deployment failures", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-166", + "Title": "Medical diagnosis AI system integration with EHR challenges", + "Status": "backlog", + "Projects": ["project-19"] + }, + { + "id": "bug-167", + "Title": "Cloud-based collaboration tool real-time sync issues", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-168", + "Title": "AI-powered chatbot misinterpreting complex queries", + "Status": "backlog", + "Projects": ["project-4"] + }, + { + "id": "bug-169", + "Title": "Blockchain voting system anonymity concerns", + "Status": "done", + "Projects": ["project-6"] + }, + { + "id": "bug-170", + "Title": "IoT smart city traffic management system data accuracy issues", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-171", + "Title": "AR retail app product visualization glitches", + "Status": "backlog", + "Projects": ["project-10"] + }, + { + "id": "bug-172", + "Title": "Machine learning model drift in financial forecasting", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-173", + "Title": "5G network slicing resource allocation inefficiencies", + "Status": "backlog", + "Projects": ["project-14"] + }, + { + "id": "bug-174", + "Title": "Quantum computing simulator performance bottlenecks", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-175", + "Title": "Edge computing device management scalability issues", + "Status": "done", + "Projects": ["project-18"] + }, + { + "id": "bug-176", + "Title": "Robotic process automation script failures in legacy systems", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-177", + "Title": "Natural language processing model bias in multilingual contexts", + "Status": "backlog", + "Projects": ["project-4"] + }, + { + "id": "bug-178", + "Title": "Autonomous vehicle sensor data fusion inaccuracies", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-179", + "Title": "Cybersecurity threat intelligence sharing platform latency", + "Status": "backlog", + "Projects": ["project-8"] + }, + { + "id": "bug-180", + "Title": "Digital twin synchronization issues in manufacturing", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-181", + "Title": "Predictive maintenance algorithm false positives", + "Status": "done", + "Projects": ["project-12"] + }, + { + "id": "bug-182", + "Title": "Blockchain-based supply chain traceability data inconsistencies", + "Status": "inProgress", + "Projects": ["project-14"] + }, + { + "id": "bug-183", + "Title": "Smart grid energy distribution optimization failures", + "Status": "backlog", + "Projects": ["project-16"] + }, + { + "id": "bug-184", + "Title": "VR training simulation motion sickness issues", + "Status": "inProgress", + "Projects": ["project-18"] + }, + { + "id": "bug-185", + "Title": "AI-powered personal assistant privacy concerns", + "Status": "backlog", + "Projects": ["project-2"] + }, + { + "id": "bug-186", + "Title": "Cloud-native microservices communication failures", + "Status": "inProgress", + "Projects": ["project-4"] + }, + { + "id": "bug-187", + "Title": "Biometric authentication system false rejections", + "Status": "done", + "Projects": ["project-6"] + }, + { + "id": "bug-188", + "Title": "Drone delivery system navigation errors in urban environments", + "Status": "inProgress", + "Projects": ["project-8"] + }, + { + "id": "bug-189", + "Title": "Quantum cryptography key distribution vulnerabilities", + "Status": "backlog", + "Projects": ["project-10"] + }, + { + "id": "bug-190", + "Title": "Augmented reality workspace collaboration tool lag", + "Status": "inProgress", + "Projects": ["project-12"] + }, + { + "id": "bug-191", + "Title": "IoT-based smart agriculture sensor calibration drift", + "Status": "backlog", + "Projects": ["project-14"] + }, + { + "id": "bug-192", + "Title": "Federated learning model convergence issues", + "Status": "inProgress", + "Projects": ["project-16"] + }, + { + "id": "bug-193", + "Title": "Blockchain-based digital rights management system scalability", + "Status": "done", + "Projects": ["project-18"] + }, + { + "id": "bug-194", + "Title": "AI-powered medical image analysis false negatives", + "Status": "inProgress", + "Projects": ["project-2"] + }, + { + "id": "bug-195", + "Title": "Smart contract vulnerability in decentralized finance platform", + "Status": "backlog", + "Projects": ["project-4"] + }, + { + "id": "bug-196", + "Title": "Edge AI inference latency in real-time video analytics", + "Status": "inProgress", + "Projects": ["project-6"] + }, + { + "id": "bug-197", + "Title": "Quantum machine learning algorithm overfitting", + "Status": "backlog", + "Projects": ["project-8"] + }, + { + "id": "bug-198", + "Title": "5G network slicing security isolation breaches", + "Status": "inProgress", + "Projects": ["project-10"] + }, + { + "id": "bug-199", + "Title": "Robotic process automation workflow exceptions handling", + "Status": "done", + "Projects": ["project-12"] + }, + { + "id": "bug-200", + "Title": "Natural language generation coherence issues in long-form content", + "Status": "inProgress", + "Projects": ["project-14"] } ] } From ec7d0ee6fafca9e51d9f75d82b5bee0316aa5017 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 11:25:42 +0800 Subject: [PATCH 06/16] chore: remove buttong --- apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte b/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte index 8bb918646..9cd2cbc24 100644 --- a/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte +++ b/apps/frontend/src/lib/components/blocks/nav/nav-tools.svelte @@ -83,7 +83,7 @@ Create New Base - + --> {/if} From c87ed502429dd85990879dfa9e0eb1701d206d01 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 11:41:05 +0800 Subject: [PATCH 07/16] fix: fix kanban card button --- .../blocks/field-control/button-control.svelte | 5 +++-- .../field-control/reference-control.svelte | 18 +++++++++++++----- .../blocks/field-value/reference-field.svelte | 15 ++++++++++++--- .../editable-cell/reference-cell.svelte | 8 +++++--- .../foreign-records-picker-dropdown.svelte | 6 +++--- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/field-control/button-control.svelte b/apps/frontend/src/lib/components/blocks/field-control/button-control.svelte index 270cf5c72..2a1c3ec99 100644 --- a/apps/frontend/src/lib/components/blocks/field-control/button-control.svelte +++ b/apps/frontend/src/lib/components/blocks/field-control/button-control.svelte @@ -32,7 +32,8 @@ }, }) - function handleClick() { + function handleClick(e: Event) { + e.stopPropagation() const option = field.option.into(undefined) if (!option) return const action = option.action @@ -49,7 +50,7 @@
- {:else} - + {/if} {#if hasValueReactive} - - + + {/if}
diff --git a/apps/frontend/src/lib/components/blocks/field-value/reference-field.svelte b/apps/frontend/src/lib/components/blocks/field-value/reference-field.svelte index 414eb9f2d..7ea7d0107 100644 --- a/apps/frontend/src/lib/components/blocks/field-value/reference-field.svelte +++ b/apps/frontend/src/lib/components/blocks/field-value/reference-field.svelte @@ -12,13 +12,22 @@
- + {#if hasValue} - {:else} - + {/if}
diff --git a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte index fc0f377e2..9920d55da 100644 --- a/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte +++ b/apps/frontend/src/lib/components/blocks/grid-view/editable-cell/reference-cell.svelte @@ -40,13 +40,14 @@ {recordId} bind:isSelected={hasValue} bind:selected + let:builder > {#if hasValueReactive} - {:else} - + {/if} @@ -60,8 +61,9 @@ {recordId} bind:selected isSelected={false} + let:builder > - + {/if} diff --git a/apps/frontend/src/lib/components/blocks/reference/foreign-records-picker-dropdown.svelte b/apps/frontend/src/lib/components/blocks/reference/foreign-records-picker-dropdown.svelte index c2099af55..031763df5 100644 --- a/apps/frontend/src/lib/components/blocks/reference/foreign-records-picker-dropdown.svelte +++ b/apps/frontend/src/lib/components/blocks/reference/foreign-records-picker-dropdown.svelte @@ -31,9 +31,9 @@ - - - + + + From 4a90b8915f318fdd245a36421a2cdd6792e76234 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 11:43:06 +0800 Subject: [PATCH 08/16] fix: fix lookup date value --- packages/persistence/src/record/record-utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/persistence/src/record/record-utils.ts b/packages/persistence/src/record/record-utils.ts index 389a2718a..42ad70853 100644 --- a/packages/persistence/src/record/record-utils.ts +++ b/packages/persistence/src/record/record-utils.ts @@ -133,9 +133,11 @@ export function getRecordDTOFromEntity(table: TableDo, entity: any, foreignTable function handleValue(value: (string | number)[]) { if (lookupField?.type === "date") { - return value.map((v: string | number) => new Date(v).toISOString()).map(formatter) + return value + .map((v: string | number) => (v ? new Date(v).toISOString() : null)) + .map((v) => (v ? formatter(v) : null)) } else if (lookupField?.type === "select") { - return value.map((v) => lookupField.getOptionById(v)?.name) + return value.map((v) => lookupField.getOptionById(v)?.name ?? null) } else { return value } From d5bdadcb131991c7ad5cda18a379c662e54ba13b Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 12:00:51 +0800 Subject: [PATCH 09/16] fix: submit form id is not required --- packages/openapi/src/openapi/record.openapi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openapi/src/openapi/record.openapi.ts b/packages/openapi/src/openapi/record.openapi.ts index f56398668..fda32b6dd 100644 --- a/packages/openapi/src/openapi/record.openapi.ts +++ b/packages/openapi/src/openapi/record.openapi.ts @@ -236,7 +236,7 @@ export const createRecords = (base: Base, table: TableDo): RouteConfig => { export const submitFormCreateRecordComponent = (table: TableDo, form: FormVO, record?: IReadableRecordDTO) => { return z .object({ - id: recordId.openapi(RECORD_ID_COMPONENT, { example: record?.id }), + id: recordId.optional().openapi(RECORD_ID_COMPONENT, { example: record?.id }), values: table.schema.getMutableSchemaFromForm(form, table.schema.mutableFields, false), }) .openapi(form.name + ":" + FORM_SUBMIT_RECORD_COMPONENT, { From e98c410130c64e7469b8629c87e013565fd6cf36 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 13:46:18 +0800 Subject: [PATCH 10/16] feat: create record with id --- .../blocks/create-record/create-record.svelte | 40 ++++++++++++++++--- .../handlers/create-record.command-handler.ts | 2 +- .../commands/src/create-record.command.ts | 2 + .../records/record/dto/create-record.dto.ts | 2 +- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/create-record/create-record.svelte b/apps/frontend/src/lib/components/blocks/create-record/create-record.svelte index c1ab1b219..944c91c17 100644 --- a/apps/frontend/src/lib/components/blocks/create-record/create-record.svelte +++ b/apps/frontend/src/lib/components/blocks/create-record/create-record.svelte @@ -8,11 +8,12 @@ import { zodClient } from "sveltekit-superforms/adapters" import { toast } from "svelte-sonner" import { derived, type Readable } from "svelte/store" - import { FormIdVO, RecordDO, RecordIdVO, TableDo } from "@undb/table" + import { FormIdVO, ID_TYPE, RecordDO, RecordIdVO, TableDo } from "@undb/table" import autoAnimate from "@formkit/auto-animate" import { cn } from "$lib/utils" import { defaultRecordValues, getRecordsStore } from "$lib/store/records.store" import { useMediaQuery } from "$lib/store/media-query.store" + import IdControl from "../field-control/id-control.svelte" // beforeNavigate(({ cancel }) => { // if ($tainted) { @@ -55,17 +56,18 @@ })), ) - const createRecord = (values: any) => { + const createRecord = ({ id, ...values }: any) => { $createRecordMutation.mutate({ tableId: $table.id.value, + id, values, }) } - $: defaultValue = $table.getDefaultValues( - formId ? new FormIdVO(formId) : undefined, - $defaultRecordValues ?? undefined, - ) + $: defaultValue = { + ...$table.getDefaultValues(formId ? new FormIdVO(formId) : undefined, $defaultRecordValues ?? undefined), + [ID_TYPE]: null, + } const form = superForm(defaults(defaultValue, zodClient(schema)), { SPA: true, @@ -98,11 +100,37 @@ // TODO: get creatable fields .filter((f) => f.type !== "button") + $: idField = $table.schema.getIdField() + $: tempRecord = RecordDO.fromJSON($table, { id: RecordIdVO.create().value, values: $formData })
    + {#if idField} + + + +
    + + ID +
    +
    +
    + + +
    +
    +
    + {/if} {#each fields as field} {@const shouldShow = !tableForm || tableForm.getShouldShowField(field.id.value, $table.schema, tempRecord)} {#if shouldShow} diff --git a/packages/command-handlers/src/handlers/create-record.command-handler.ts b/packages/command-handlers/src/handlers/create-record.command-handler.ts index 4329824bb..2ca54c754 100644 --- a/packages/command-handlers/src/handlers/create-record.command-handler.ts +++ b/packages/command-handlers/src/handlers/create-record.command-handler.ts @@ -16,7 +16,7 @@ export class CreateRecordCommandHandler implements ICommandHandler { this.logger.debug(command, "executing create record command") - const record = await this.service.createRecord(command, { values: command.values }) + const record = await this.service.createRecord(command, { id: command.id, values: command.values }) return record.id.value } diff --git a/packages/commands/src/create-record.command.ts b/packages/commands/src/create-record.command.ts index ca8b7f7de..d21a560d4 100644 --- a/packages/commands/src/create-record.command.ts +++ b/packages/commands/src/create-record.command.ts @@ -8,6 +8,7 @@ export const createRecordCommand = createRecordDTO.merge(uniqueTableDTO) export type ICreateRecordCommand = z.infer export class CreateRecordCommand extends Command implements ICreateRecordCommand { + public readonly id?: string public readonly tableId?: string public readonly baseName?: string public readonly tableName?: string @@ -15,6 +16,7 @@ export class CreateRecordCommand extends Command implements ICreateRecordCommand constructor(props: CommandProps) { super(props) + this.id = props.id this.tableId = props.tableId this.baseName = props.baseName this.tableName = props.tableName diff --git a/packages/table/src/modules/records/record/dto/create-record.dto.ts b/packages/table/src/modules/records/record/dto/create-record.dto.ts index afcea43c4..15b95e2c3 100644 --- a/packages/table/src/modules/records/record/dto/create-record.dto.ts +++ b/packages/table/src/modules/records/record/dto/create-record.dto.ts @@ -3,7 +3,7 @@ import { recordId } from "../record-id.vo" import { recordValues } from "../record-values.vo" export const createRecordDTO = z.object({ - id: recordId.optional(), + id: recordId.optional().nullable(), values: recordValues, }) From 4ca498417652e4efb40f8168b5cd08ee66dd61f3 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 13:48:20 +0800 Subject: [PATCH 11/16] fix: fix type --- packages/commands/src/create-record.command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/commands/src/create-record.command.ts b/packages/commands/src/create-record.command.ts index d21a560d4..13fc77134 100644 --- a/packages/commands/src/create-record.command.ts +++ b/packages/commands/src/create-record.command.ts @@ -8,7 +8,7 @@ export const createRecordCommand = createRecordDTO.merge(uniqueTableDTO) export type ICreateRecordCommand = z.infer export class CreateRecordCommand extends Command implements ICreateRecordCommand { - public readonly id?: string + public readonly id?: string | null public readonly tableId?: string public readonly baseName?: string public readonly tableName?: string From 5a1f99de9e3c213385e4c7ffd603aef5fae7a875 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 14:02:37 +0800 Subject: [PATCH 12/16] feat: set field width schema --- packages/table/src/dto/set-field-width.dto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/table/src/dto/set-field-width.dto.ts b/packages/table/src/dto/set-field-width.dto.ts index 98c1a3534..9628103f9 100644 --- a/packages/table/src/dto/set-field-width.dto.ts +++ b/packages/table/src/dto/set-field-width.dto.ts @@ -7,7 +7,7 @@ export const setFieldWidthDTO = z.object({ tableId: tableId, viewId: viewId.optional(), field: fieldId, - width: z.number(), + width: z.number().positive(), }) export type ISetFieldWidthDTO = z.infer From 1a005a43413a6213a5f0cc3ed2766073187c2f24 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 14:46:15 +0800 Subject: [PATCH 13/16] fix: fix kanban get data --- .../blocks/kanban-view/kanban-card.svelte | 4 +- .../kanban-view/select-kanban-lane.svelte | 66 +++++++++---------- .../blocks/view/set-as-default-view.svelte | 2 +- .../src/methods/set-default-view.method.ts | 2 +- .../table/src/methods/update-view.method.ts | 2 +- 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte index 2dc615c64..5308d24e8 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte @@ -16,8 +16,8 @@ const r = queryParam("r") - let values = record.flatten() - let displayValues = record.displayValues?.toJSON() ?? {} + $: values = record.flatten() + $: displayValues = record.displayValues?.toJSON() ?? {} $: colorSpec = color?.getSpec($table.schema).into(undefined) $: isMatch = colorSpec ? record.match(colorSpec) : false diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte index bfd26e09d..6ca5805b7 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/select-kanban-lane.svelte @@ -61,39 +61,6 @@ const q = queryParam("q") - const getRecords = ({ pageParam = 1 }) => { - if (shareId) { - return trpc.shareData.records.query({ - shareId, - tableId, - viewId: $viewId, - q: $q, - filters: { - conjunction: "and", - children: [{ field: fieldId, op: "eq", value: option ? option.id : null }], - }, - pagination: { - page: pageParam, - limit: 20, - }, - }) - } - - return trpc.record.list.query({ - tableId, - viewId: $viewId, - q: $q ?? undefined, - filters: { - conjunction: "and", - children: [{ field: fieldId, op: "eq", value: option ? option.id : null }], - }, - pagination: { - page: pageParam, - limit: 20, - }, - }) - } - let getIsLaneCollapsed = kanbanStore.getIsLaneCollapsed $: isLaneCollapsed = $getIsLaneCollapsed($viewId, option?.id ?? "") ?? false @@ -102,7 +69,38 @@ const view = $table.views.getViewById($viewId) return { queryKey: [$table.id.value, $viewId, fieldId, "getRecords", option?.id, $q], - queryFn: getRecords, + queryFn: ({ pageParam = 1 }) => { + if (shareId) { + return trpc.shareData.records.query({ + shareId, + tableId: $table.id.value, + viewId: $viewId, + q: $q, + filters: { + conjunction: "and", + children: [{ field: fieldId, op: "eq", value: option ? option.id : null }], + }, + pagination: { + page: pageParam, + limit: 20, + }, + }) + } + + return trpc.record.list.query({ + tableId: $table.id.value, + viewId: $viewId, + q: $q ?? undefined, + filters: { + conjunction: "and", + children: [{ field: fieldId, op: "eq", value: option ? option.id : null }], + }, + pagination: { + page: pageParam, + limit: 20, + }, + }) + }, initialPageParam: 1, getNextPageParam: (lastPage, pages) => { const current = pages.reduce((acc, cur) => acc + (cur as any).records.length, 0) diff --git a/apps/frontend/src/lib/components/blocks/view/set-as-default-view.svelte b/apps/frontend/src/lib/components/blocks/view/set-as-default-view.svelte index 0ad7d4f4e..ad411b4d0 100644 --- a/apps/frontend/src/lib/components/blocks/view/set-as-default-view.svelte +++ b/apps/frontend/src/lib/components/blocks/view/set-as-default-view.svelte @@ -39,7 +39,7 @@ disabled={$setAsDefaultViewMutation.isPending} on:click={() => $setAsDefaultViewMutation.mutate({ tableId: $table.id.value, viewId: $viewId })} > - Continue + Set as Default View diff --git a/packages/table/src/methods/set-default-view.method.ts b/packages/table/src/methods/set-default-view.method.ts index 9568caf28..6e76a1017 100644 --- a/packages/table/src/methods/set-default-view.method.ts +++ b/packages/table/src/methods/set-default-view.method.ts @@ -4,7 +4,7 @@ import type { TableComositeSpecification } from "../specifications" import type { TableDo } from "../table.do" export function setDefaultView(this: TableDo, dto: ISetDefaultViewDTO): Option { - const spec = this.views.$setDefaultView(dto) + const spec = this.views.$setDefaultView(this, dto) if (spec.isSome()) { spec.unwrap().mutate(this) diff --git a/packages/table/src/methods/update-view.method.ts b/packages/table/src/methods/update-view.method.ts index 6fc19bcac..03e0d9252 100644 --- a/packages/table/src/methods/update-view.method.ts +++ b/packages/table/src/methods/update-view.method.ts @@ -8,7 +8,7 @@ import type { TableDo } from "../table.do" export function updateView(this: TableDo, dto: IUpdateViewDTO): Option { const view = this.views.getViewById(dto.viewId) - const spec = view.$update(dto) + const spec = view.$update(this, dto) if (spec.isSome()) { spec.unwrap().mutate(this) From e892ff5b8bafb1ef9ade3c3c2b9933841e53fc72 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 14:55:35 +0800 Subject: [PATCH 14/16] fix: fix duplicate view --- packages/table/src/methods/duplicate-view.method.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/table/src/methods/duplicate-view.method.ts b/packages/table/src/methods/duplicate-view.method.ts index 24b328812..40169fe84 100644 --- a/packages/table/src/methods/duplicate-view.method.ts +++ b/packages/table/src/methods/duplicate-view.method.ts @@ -11,7 +11,7 @@ export function duplicateViewMethod( dto: IDuplicateViewDTO, ): { spec: Option; view: View } { const view = this.views.getViewById(dto.viewId) - const spec = view.$duplicate(dto) + const spec = view.$duplicate(this, dto) const names = this.views.views.map((v) => v.name.value) applyRules(new ViewNameShouldBeUnique(names)) From 129bc9b3388c690629902dcebda5b9ccfcb6e3a4 Mon Sep 17 00:00:00 2001 From: nichenqin Date: Tue, 24 Sep 2024 15:03:17 +0800 Subject: [PATCH 15/16] fix: fix kanban card ui --- .../blocks/kanban-view/kanban-card.svelte | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte index 5308d24e8..a2aa470ef 100644 --- a/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte +++ b/apps/frontend/src/lib/components/blocks/kanban-view/kanban-card.svelte @@ -28,32 +28,31 @@ on:click={() => ($r = record.id.value)} disabled={readonly} data-record-id={record.id.value} - class={cn( - "relative mb-2 flex w-full flex-col space-y-2 overflow-hidden rounded bg-white p-2 shadow", - isMatch && "pl-3", - )} + class={cn("relative mb-2 flex w-full flex-col overflow-hidden rounded bg-white p-2 shadow", isMatch && "pl-3")} > +
    + {#each fields as field, idx (field.id.value)} +
    + + + + + +

    {field.name.value}

    +
    +
    +
    + {/each} +
    {#if isMatch}
    {/if} - {#each fields as field} -
    - - - - - -

    {field.name.value}

    -
    -
    -
    - {/each} From b4286ea4df7c50d0a03d76dedd1de4ab9a45e601 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Tue, 24 Sep 2024 07:04:29 +0000 Subject: [PATCH 16/16] Prepare release v1.0.0-88 --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefec725e..afa6ef44c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## v1.0.0-88 + + +### 🩹 Fixes + +- Fix kanban card ui ([129bc9b](https://github.com/undb-io/undb/commit/129bc9b)) + +### ❤️ Contributors + +- Nichenqin ([@nichenqin](http://github.com/nichenqin)) + ## v1.0.0-87 diff --git a/package.json b/package.json index 8d9c1de7a..aabb1a1a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "undb", - "version": "1.0.0-87", + "version": "1.0.0-88", "private": true, "scripts": { "build": "NODE_ENV=production bun --bun turbo build",