Skip to content

Commit

Permalink
test(sequelize): replicate duplicate column error with Sequelize belo…
Browse files Browse the repository at this point in the history
  • Loading branch information
KalleV committed Jun 18, 2023
1 parent 5ed00ea commit 3c29d85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Entity, model, property} from '@loopback/repository';
import {Entity, belongsTo, model, property} from '@loopback/repository';
import {Patient} from './patient.model';

@model()
export class Appointment extends Entity {
Expand All @@ -14,9 +15,13 @@ export class Appointment extends Entity {
})
doctorId?: number;

@property({
type: 'number',
})
@belongsTo(
() => Patient,
{keyTo: 'id', name: 'patient'},
{
type: 'number',
},
)
patientId?: number;

constructor(data?: Partial<Appointment>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class TodoList extends Entity {
title: string;

@hasMany(() => Todo, {
keyTo: 'todoListId',
// keyTo: 'todoListId',
})
todos: Todo[];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Todo extends Entity {
})
isComplete?: boolean;

@belongsTo(() => TodoList, {name: 'todoList'}, {name: 'todo_list_id'})
@belongsTo(() => TodoList, {name: 'todoList'} /* {name: 'todo_list_id'} */)
todoListId: number;

constructor(data?: Partial<Todo>) {
Expand Down

0 comments on commit 3c29d85

Please sign in to comment.