-
-
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.
- Loading branch information
Showing
18 changed files
with
168 additions
and
2 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
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 |
---|---|---|
|
@@ -31,6 +31,9 @@ query GetShareBaseData($shareId: ID!) { | |
name | ||
type | ||
isDefault | ||
grid { | ||
widths | ||
} | ||
kanban { | ||
field | ||
} | ||
|
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
24 changes: 24 additions & 0 deletions
24
packages/command-handlers/src/handlers/set-field-width.command-handler.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,24 @@ | ||
import { SetFieldWidthCommand } from "@undb/commands" | ||
import { commandHandler } from "@undb/cqrs" | ||
import { singleton } from "@undb/di" | ||
import type { ICommandHandler } from "@undb/domain" | ||
import { createLogger } from "@undb/logger" | ||
import { TableIdVo, injectTableRepository, type ITableRepository } from "@undb/table" | ||
|
||
@commandHandler(SetFieldWidthCommand) | ||
@singleton() | ||
export class SetFieldWidthCommandHandler implements ICommandHandler<SetFieldWidthCommand, any> { | ||
public readonly logger = createLogger(SetFieldWidthCommandHandler.name) | ||
constructor( | ||
@injectTableRepository() | ||
private readonly repo: ITableRepository, | ||
) {} | ||
|
||
async execute(command: SetFieldWidthCommand): Promise<any> { | ||
const table = (await this.repo.findOneById(new TableIdVo(command.tableId))).unwrap() | ||
|
||
const spec = table.$setFieldWidth(command) | ||
|
||
await this.repo.updateOneById(table, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Command, type CommandProps } from "@undb/domain" | ||
import { setFieldWidthDTO } from "@undb/table" | ||
import { z } from "@undb/zod" | ||
|
||
export const setFieldWidthCommand = setFieldWidthDTO | ||
|
||
export type ISetFieldWidthCommand = z.infer<typeof setFieldWidthCommand> | ||
|
||
export class SetFieldWidthCommand extends Command { | ||
public readonly tableId: string | ||
public readonly viewId?: string | ||
public readonly field: string | ||
public readonly width: number | ||
|
||
constructor(props: CommandProps<ISetFieldWidthCommand>) { | ||
super(props) | ||
this.tableId = props.tableId | ||
this.viewId = props.viewId | ||
this.field = props.field | ||
this.width = props.width | ||
} | ||
} |
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,13 @@ | ||
import { z } from "@undb/zod" | ||
import { viewId } from "../modules" | ||
import { fieldId } from "../modules/schema/fields/field-id.vo" | ||
import { tableId } from "../table-id.vo" | ||
|
||
export const setFieldWidthDTO = z.object({ | ||
tableId: tableId, | ||
viewId: viewId.optional(), | ||
field: fieldId, | ||
width: z.number(), | ||
}) | ||
|
||
export type ISetFieldWidthDTO = z.infer<typeof setFieldWidthDTO> |
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,14 @@ | ||
import { type Option } from "@undb/domain" | ||
import type { ISetFieldWidthDTO } from "../dto" | ||
import type { TableComositeSpecification } from "../specifications" | ||
import type { TableDo } from "../table.do" | ||
|
||
export function setFieldWidth(this: TableDo, dto: ISetFieldWidthDTO): Option<TableComositeSpecification> { | ||
const view = this.views.getViewById(dto.viewId) | ||
|
||
if (view.type !== "grid") { | ||
throw new Error("View type is not grid") | ||
} | ||
|
||
throw new Error("Not implemented") | ||
} |
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.