@central-credit/engine
Version:
Engine to handle the Serasa requests
43 lines (31 loc) • 961 B
text/typescript
import { Entity, model, property, ValueObject } from '@loopback/repository'
import { RecordFieldType } from './record.model'
export class LayoutField extends ValueObject {
seq: number
size: number
value?: string
type?: RecordFieldType
description?: string
}
export type LayoutFields = 'protocol' | 'options' | 'data'
()
export class Layout extends Entity {
({ id: true })
id: string
({ required: true })
name: string
.array(LayoutField, { required: true })
protocol: LayoutField[]
.array(LayoutField, { required: true })
options: LayoutField[]
.array(LayoutField)
data: LayoutField[]
constructor(data?: Partial<Layout>) {
super(data)
}
getOrdered(field: LayoutFields): LayoutField[] {
return this[field].sort((field1, field2) => field1.seq - field2.seq)
}
}
export interface LayoutRelations {}
export type LayoutWithRelations = Layout & LayoutRelations