mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +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 {
|
||||
@Prop(TypeString(), 'State' as IntlString)
|
||||
state!: Ref<State>
|
||||
|
||||
@Prop(TypeString(), 'No.' as IntlString)
|
||||
number!: number
|
||||
}
|
||||
|
||||
@Model(core.class.SpaceWithStates, core.class.Space)
|
||||
|
@ -141,22 +141,22 @@ export function createModel (builder: Builder): void {
|
||||
state: core.class.State
|
||||
}
|
||||
} 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, {
|
||||
attachTo: recruit.class.Applicant,
|
||||
descriptor: view.viewlet.Kanban,
|
||||
open: recruit.component.EditCandidate,
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
options: {
|
||||
lookup: {
|
||||
candidate: recruit.class.Candidate,
|
||||
state: core.class.State
|
||||
}
|
||||
} as FindOptions<Doc>, // TODO: fix
|
||||
config: ['$lookup.candidate', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
||||
})
|
||||
// builder.createDoc(view.class.Viewlet, core.space.Model, {
|
||||
// attachTo: recruit.class.Applicant,
|
||||
// descriptor: view.viewlet.Kanban,
|
||||
// open: recruit.component.EditCandidate,
|
||||
// // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
// options: {
|
||||
// lookup: {
|
||||
// candidate: recruit.class.Candidate,
|
||||
// state: core.class.State
|
||||
// }
|
||||
// } as FindOptions<Doc>, // TODO: fix
|
||||
// config: ['$lookup.candidate', '$lookup.state', '$lookup.candidate.city', '$lookup.candidate.channels']
|
||||
// })
|
||||
|
||||
builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.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)
|
||||
export class TKanban extends TDoc implements Kanban {
|
||||
attachedTo!: Ref<Space>
|
||||
sequence!: number
|
||||
states!: Arr<Ref<State>>
|
||||
order!: Arr<Ref<Doc>>
|
||||
}
|
||||
|
@ -209,6 +209,7 @@ export interface State extends Doc {
|
||||
*/
|
||||
export interface DocWithState extends Doc {
|
||||
state: Ref<State>
|
||||
number: number
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,22 +53,18 @@
|
||||
if (state === undefined) {
|
||||
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, {
|
||||
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>) {
|
||||
|
@ -86,6 +86,7 @@ export interface ActionTarget extends Doc {
|
||||
*/
|
||||
export interface Kanban extends Doc {
|
||||
attachedTo: Ref<Space>
|
||||
sequence: number
|
||||
states: Arr<Ref<State>>
|
||||
order: Arr<Ref<Doc>>
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user