Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit a4ae919

Browse files
committed
refactor(repository): add comments, separate utility code
1 parent 627b3fc commit a4ae919

File tree

5 files changed

+130
-75
lines changed

5 files changed

+130
-75
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm install loopback4-sequelize
1414

1515
## Usage
1616

17-
[Click here](https://youtu.be/tHg5ZAj29YQ) to checkout a live demo of this extension.
17+
You can watch a video demo of this extension by [clicking here](https://youtu.be/tHg5ZAj29YQ).
1818

1919
Both newly developed and existing projects can benefit from the extension. By just changing the parent classes in the target Data Source and Repositories.
2020

src/sequelize/operator-translation.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {Operators} from '@loopback/repository';
2+
import {Op} from 'sequelize';
3+
4+
/**
5+
* @key Operator used in loopback
6+
* @value Equivalent operator in Sequelize
7+
*/
8+
export const operatorTranslations: {
9+
[key in Operators]?: symbol;
10+
} = {
11+
eq: Op.eq,
12+
gt: Op.gt,
13+
gte: Op.gte,
14+
lt: Op.lt,
15+
lte: Op.lte,
16+
neq: Op.ne,
17+
between: Op.between,
18+
inq: Op.in,
19+
nin: Op.notIn,
20+
like: Op.like,
21+
nlike: Op.notLike,
22+
ilike: Op.iLike,
23+
nilike: Op.notILike,
24+
regexp: Op.regexp,
25+
and: Op.and,
26+
or: Op.or,
27+
};

src/sequelize/sequelize.model.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {AnyObject, Entity} from '@loopback/repository';
2+
import {Model} from 'sequelize';
3+
4+
export class SequelizeModel extends Model implements Entity {
5+
getId() {
6+
return null;
7+
}
8+
getIdObject(): Object {
9+
return {};
10+
}
11+
toObject(options?: AnyObject | undefined): Object {
12+
return {};
13+
}
14+
}

0 commit comments

Comments
 (0)