All files / src/models flow-category.model.ts

91.67% Statements 11/12
100% Branches 0/0
66.67% Functions 2/3
90% Lines 9/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x                                               1x 40x 1x   40x 1x                 1x                        
import { belongsTo, model, property } from '@loopback/repository';
import { BaseEntity, Company } from '.';
import { Flow } from './flow.model';
@model({
  settings: {
    postgresql: { table: 'flows_category' },
    foreignKeys: {
      fk_flows_category_flows_id: {
        name: 'fk_flows_category_flows_id',
        entity: 'Flow',
        entityKey: 'id',
        foreignKey: 'flow_id',
        onDelete: 'CASCADE',
        onUpdate: 'RESTRICT'
      },
      fk_flows_category_companies_id: {
        name: 'fk_flows_category_companies_id',
        entity: 'Company',
        entityKey: 'id',
        foreignKey: 'company_id',
        onDelete: 'CASCADE',
        onUpdate: 'RESTRICT'
      },
    },
  },
})
export class FlowCategory extends BaseEntity {
  @belongsTo(() => Flow, { name: 'flow' })
  flow_id: number;
 
  @belongsTo(() => Company, { name: 'company' })
  company_id: number;
 
  @property({
    type: 'array',
    itemType: 'number',
    postgresql: {
      dataType: 'varchar[]',
    },
  })
  category_ids: number[];
 
  constructor(data?: Partial<FlowCategory>) {
    super(data);
  }
}
 
export interface FlowCategoryRelations {
  // describe navigational properties here
}
 
export type FlowCategoryWithRelations = FlowCategory & FlowCategoryRelations;