mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 07:46:24 +00:00
add number
field for auto-incremented object id
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
1be2b83308
commit
7fb8d31f89
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,9 @@ export class TState extends TDoc implements State {
|
|||||||
export class TDocWithState extends TDoc {
|
export class TDocWithState extends TDoc {
|
||||||
@Prop(TypeString(), 'State' as IntlString)
|
@Prop(TypeString(), 'State' as IntlString)
|
||||||
state!: Ref<State>
|
state!: Ref<State>
|
||||||
|
|
||||||
|
@Prop(TypeString(), 'No.' as IntlString)
|
||||||
|
number!: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@Model(core.class.SpaceWithStates, core.class.Space)
|
@Model(core.class.SpaceWithStates, core.class.Space)
|
||||||
|
@ -141,22 +141,22 @@ export function createModel (builder: Builder): void {
|
|||||||
state: core.class.State
|
state: core.class.State
|
||||||
}
|
}
|
||||||
} as FindOptions<Doc>, // TODO: fix
|
} as FindOptions<Doc>, // TODO: fix
|
||||||
config: ['$lookup.candidate', { presenter: recruit.component.ApplicationPresenter, label: 'Application' }, '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
config: ['number', '$lookup.candidate', { presenter: recruit.component.ApplicationPresenter, label: 'Application' }, '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
||||||
})
|
})
|
||||||
|
|
||||||
builder.createDoc(view.class.Viewlet, core.space.Model, {
|
// builder.createDoc(view.class.Viewlet, core.space.Model, {
|
||||||
attachTo: recruit.class.Applicant,
|
// attachTo: recruit.class.Applicant,
|
||||||
descriptor: view.viewlet.Kanban,
|
// descriptor: view.viewlet.Kanban,
|
||||||
open: recruit.component.EditCandidate,
|
// open: recruit.component.EditCandidate,
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
// // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||||
options: {
|
// options: {
|
||||||
lookup: {
|
// lookup: {
|
||||||
candidate: recruit.class.Candidate,
|
// candidate: recruit.class.Candidate,
|
||||||
state: core.class.State
|
// state: core.class.State
|
||||||
}
|
// }
|
||||||
} as FindOptions<Doc>, // TODO: fix
|
// } as FindOptions<Doc>, // TODO: fix
|
||||||
config: ['$lookup.candidate', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
// config: ['$lookup.candidate', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
||||||
})
|
// })
|
||||||
|
|
||||||
builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.KanbanCard, {
|
builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.KanbanCard, {
|
||||||
card: recruit.component.KanbanCard
|
card: recruit.component.KanbanCard
|
||||||
|
@ -76,6 +76,7 @@ export class TActionTarget extends TDoc implements ActionTarget {
|
|||||||
@Model(view.class.Kanban, core.class.Doc, DOMAIN_KANBAN)
|
@Model(view.class.Kanban, core.class.Doc, DOMAIN_KANBAN)
|
||||||
export class TKanban extends TDoc implements Kanban {
|
export class TKanban extends TDoc implements Kanban {
|
||||||
attachedTo!: Ref<Space>
|
attachedTo!: Ref<Space>
|
||||||
|
sequence!: number
|
||||||
states!: Arr<Ref<State>>
|
states!: Arr<Ref<State>>
|
||||||
order!: Arr<Ref<Doc>>
|
order!: Arr<Ref<Doc>>
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,7 @@ export interface State extends Doc {
|
|||||||
*/
|
*/
|
||||||
export interface DocWithState extends Doc {
|
export interface DocWithState extends Doc {
|
||||||
state: Ref<State>
|
state: Ref<State>
|
||||||
|
number: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,22 +53,18 @@
|
|||||||
if (state === undefined) {
|
if (state === undefined) {
|
||||||
throw new Error('create application: state not found')
|
throw new Error('create application: state not found')
|
||||||
}
|
}
|
||||||
|
const kanban = await client.findOne(view.class.Kanban, { attachedTo: _space })
|
||||||
|
if (kanban === undefined) {
|
||||||
|
throw new Error('kanban object not found')
|
||||||
|
}
|
||||||
|
const incResult = await client.updateDoc(view.class.Kanban, _space, kanban._id, {
|
||||||
|
$inc: { sequence: 1 }
|
||||||
|
}, true)
|
||||||
const id = await client.createDoc(recruit.class.Applicant, _space, {
|
const id = await client.createDoc(recruit.class.Applicant, _space, {
|
||||||
candidate,
|
candidate,
|
||||||
state: state._id
|
state: state._id,
|
||||||
|
number: incResult.object.sequence
|
||||||
})
|
})
|
||||||
|
|
||||||
// const kanban = await client.findOne(view.class.Kanban, { attachedTo: _space })
|
|
||||||
|
|
||||||
// if (kanban === undefined) {
|
|
||||||
// throw new Error('kanban object not found')
|
|
||||||
// }
|
|
||||||
|
|
||||||
// await client.updateDoc(view.class.Kanban, _space, kanban._id, {
|
|
||||||
// $push: {
|
|
||||||
// order: id
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function validate(candidate: Ref<Candidate>, space: Ref<Space>) {
|
async function validate(candidate: Ref<Candidate>, space: Ref<Space>) {
|
||||||
|
@ -86,6 +86,7 @@ export interface ActionTarget extends Doc {
|
|||||||
*/
|
*/
|
||||||
export interface Kanban extends Doc {
|
export interface Kanban extends Doc {
|
||||||
attachedTo: Ref<Space>
|
attachedTo: Ref<Space>
|
||||||
|
sequence: number
|
||||||
states: Arr<Ref<State>>
|
states: Arr<Ref<State>>
|
||||||
order: Arr<Ref<Doc>>
|
order: Arr<Ref<Doc>>
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user