-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow belongsTo relation with same table
Signed-off-by: Muhammad Aaqil <aaqilniz@yahoo.com>
- Loading branch information
Showing
10 changed files
with
311 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/cli/test/fixtures/relation/controllers/employee.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class EmployeeController {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/cli/test/fixtures/relation/models/employee.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Entity, model, property} from '@loopback/repository'; | ||
|
||
@model() | ||
export class Employee extends Entity { | ||
@property({ | ||
type: 'number', | ||
id: true, | ||
default: 0, | ||
}) | ||
id?: number; | ||
|
||
@property({ | ||
type: 'string', | ||
}) | ||
firstName?: string; | ||
|
||
@property({ | ||
type: 'string', | ||
}) | ||
lastName?: string; | ||
|
||
@property({ | ||
type: 'number', | ||
}) | ||
reportsTo?: string; | ||
|
||
constructor(data?: Partial<Employee>) { | ||
super(data); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/cli/test/fixtures/relation/repositories/employee.repository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {inject} from '@loopback/core'; | ||
import {DefaultCrudRepository} from '@loopback/repository'; | ||
import {DbDataSource} from '../datasources'; | ||
import {Employee} from '../models'; | ||
|
||
export class EmployeeRepository extends DefaultCrudRepository< | ||
Employee, | ||
typeof Employee.prototype.id | ||
> { | ||
constructor(@inject('datasources.db') dataSource: DbDataSource) { | ||
super(Employee, dataSource); | ||
} | ||
} |
Oops, something went wrong.