-
Notifications
You must be signed in to change notification settings - Fork 63
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
21 changed files
with
121 additions
and
35 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
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 |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import { ValueObject } from '@egodb/domain' | ||
import { FieldId } from '../field' | ||
import type { IKanbanSchema } from './kanban.schema' | ||
import type { IKanban } from './kanban.type' | ||
|
||
export class Kanban extends ValueObject<IKanban> { | ||
public get selectField() { | ||
return this.props.selectField | ||
static from(input: IKanbanSchema) { | ||
return new this({ | ||
fieldId: input.fieldId ? FieldId.from(input.fieldId) : undefined, | ||
}) | ||
} | ||
|
||
public get fieldId() { | ||
return this.props.fieldId | ||
} | ||
|
||
public set fieldId(fieldId: FieldId | undefined) { | ||
this.props.fieldId = fieldId | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { FieldId } from '../field' | ||
|
||
export interface IKanban { | ||
selectField: FieldId | ||
fieldId?: FieldId | ||
} |
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 |
---|---|---|
@@ -1,22 +1,27 @@ | ||
import { CompositeSpecification } from '@egodb/domain' | ||
import { Result } from 'oxide.ts/dist' | ||
import { FieldId } from '../../field' | ||
import { ITableSpecVisitor } from '../../specifications' | ||
import { Table } from '../../table' | ||
import { View } from '../view' | ||
import type { Result } from 'oxide.ts' | ||
import { Ok } from 'oxide.ts' | ||
import type { FieldId } from '../../field' | ||
import type { ITableSpecVisitor } from '../../specifications' | ||
import type { Table } from '../../table' | ||
import type { View } from '../view' | ||
|
||
export class WithKanbanField extends CompositeSpecification<Table, ITableSpecVisitor> { | ||
constructor(public readonly view: View, public readonly fieldId: FieldId) { | ||
super() | ||
} | ||
|
||
isSatisfiedBy(t: Table): boolean { | ||
throw new Error('Method not implemented.') | ||
isSatisfiedBy(): boolean { | ||
return this.view.kanbanSelectFieldId.mapOr(false, (fieldId) => fieldId.equals(this.fieldId)) | ||
} | ||
|
||
mutate(t: Table): Result<Table, string> { | ||
throw new Error('Method not implemented.') | ||
this.view.getOrCreateKanban().fieldId = this.fieldId | ||
return Ok(t) | ||
} | ||
|
||
accept(v: ITableSpecVisitor): Result<void, string> { | ||
throw new Error('Method not implemented.') | ||
v.kanbanFieldEqual(this) | ||
return Ok(undefined) | ||
} | ||
} |
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
Oops, something went wrong.