-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2069 from undb-io/release/v1.0.0-91
Release version v1.0.0-91
- Loading branch information
Showing
24 changed files
with
1,468 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/frontend/src/lib/components/blocks/base/base-detail.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { ITemplateDTO } from "@undb/template" | ||
import { getContext, setContext } from "svelte" | ||
import { type Writable, derived } from "svelte/store" | ||
|
||
export function setTemplate(template: Writable<ITemplateDTO>) { | ||
setContext("template", template) | ||
} | ||
|
||
export function getTemplate() { | ||
return getContext<Writable<ITemplateDTO | undefined>>("template") | ||
} | ||
|
||
export function getIsTemplate() { | ||
return derived([getTemplate()], ([$template]) => !!$template) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/table/src/modules/records/services/methods/create-tables-records.method.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { and, Option } from "@undb/domain" | ||
import type { TableDo } from "../../../../table.do" | ||
import { ReferenceEqual, ReferenceFieldValue } from "../../../schema" | ||
import type { RecordComositeSpecification, RecordDO } from "../../record" | ||
import type { RecordsService } from "../records.service" | ||
|
||
export async function createTablesRecordsMethod( | ||
this: RecordsService, | ||
input: { table: TableDo; records: RecordDO[] }[], | ||
): Promise<void> { | ||
for (const { table, records } of input) { | ||
await this.repo.bulkInsert(table, records) | ||
} | ||
|
||
for (const { table, records } of input) { | ||
const referenceFields = table.schema.getReferenceFields() | ||
for (const record of records) { | ||
let specs: RecordComositeSpecification[] = [] | ||
for (const field of referenceFields) { | ||
const value = record.getValue(field.id) | ||
if (value.isNone()) { | ||
continue | ||
} | ||
const referecneValue = value.unwrap() as ReferenceFieldValue | ||
if (referecneValue.value?.length) { | ||
const spec = new ReferenceEqual(value.unwrap() as ReferenceFieldValue, field.id) | ||
specs.push(spec) | ||
} | ||
} | ||
|
||
if (specs.length) { | ||
const spec = and(...specs) as Option<RecordComositeSpecification> | ||
await this.repo.updateOneById(table, record, spec) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.