@hedhog/setting 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +4 -3
- package/dist/migrations/index.js.map +1 -1
- package/dist/settings.service.d.ts.map +1 -1
- package/dist/settings.service.js +8 -1
- package/dist/settings.service.js.map +1 -1
- package/package.json +4 -4
- package/src/migrations/index.ts +2 -1
- package/src/settings.service.ts +9 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2
|
-
export declare class
|
2
|
+
export declare class Migrate implements MigrationInterface {
|
3
3
|
up(queryRunner: QueryRunner): Promise<void>;
|
4
4
|
down(queryRunner: QueryRunner): Promise<void>;
|
5
5
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAGjB,qBAAa,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAGjB,qBAAa,OAAQ,YAAW,kBAAkB;IACnC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAgE3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAI3D"}
|
package/dist/migrations/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.Migrate = void 0;
|
4
4
|
const typeorm_1 = require("typeorm");
|
5
5
|
const utils_1 = require("@hedhog/utils");
|
6
|
-
class
|
6
|
+
class Migrate {
|
7
7
|
async up(queryRunner) {
|
8
8
|
await queryRunner.createTable(new typeorm_1.Table({
|
9
9
|
name: 'settings',
|
@@ -44,6 +44,7 @@ class CreateSettings1726152718000 {
|
|
44
44
|
{
|
45
45
|
name: 'setting_id',
|
46
46
|
type: 'int',
|
47
|
+
unsigned: true,
|
47
48
|
},
|
48
49
|
(0, utils_1.timestampColumn)(),
|
49
50
|
(0, utils_1.timestampColumn)('updated_at'),
|
@@ -62,5 +63,5 @@ class CreateSettings1726152718000 {
|
|
62
63
|
await queryRunner.dropTable('settings');
|
63
64
|
}
|
64
65
|
}
|
65
|
-
exports.
|
66
|
+
exports.Migrate = Migrate;
|
66
67
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,qCAKiB;AACjB,yCAA0D;AAE1D,MAAa,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,qCAKiB;AACjB,yCAA0D;AAE1D,MAAa,OAAO;IACX,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,SAAS;iBAChB;gBACD,IAAA,uBAAe,GAAE;gBACjB,IAAA,uBAAe,EAAC,YAAY,CAAC;aAC9B;SACF,CAAC,CACH,CAAC;QAEF,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;YACR,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE;gBACP,IAAA,gBAAQ,GAAE;gBACV;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE,MAAM;iBACf;gBACD;oBACE,IAAI,EAAE,MA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;IAGxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,WAAW,CAAC,gBAAgB,EAAE,aAAa;
|
1
|
+
{"version":3,"file":"settings.service.d.ts","sourceRoot":"","sources":["../src/settings.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,EAE5B,iBAAiB,EAAE,iBAAiB;IAGjD,WAAW,CAAC,gBAAgB,EAAE,aAAa;IA8B3C,GAAG,CAAC,SAAS,EAAE,MAAM;IAMrB,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;IAM1B,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAehC"}
|
package/dist/settings.service.js
CHANGED
@@ -24,9 +24,16 @@ let SettingsService = class SettingsService {
|
|
24
24
|
async getSettings(paginationParams) {
|
25
25
|
const OR = [
|
26
26
|
{
|
27
|
-
name: { contains: paginationParams.search
|
27
|
+
name: { contains: paginationParams.search },
|
28
28
|
},
|
29
29
|
];
|
30
|
+
if (this.prismaService.getProvider() === 'postgres') {
|
31
|
+
for (let i = 0; i < OR.length; i++) {
|
32
|
+
for (let x = 0; x < Object.keys(OR[i]).length; x++) {
|
33
|
+
OR[i][Object.keys(OR[i])[x]].insensitive = true;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
30
37
|
if (!isNaN(+paginationParams.search)) {
|
31
38
|
OR.push({ id: { equals: +paginationParams.search } });
|
32
39
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.service.js","sourceRoot":"","sources":["../src/settings.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,gBAA+B;QAC/C,MAAM,EAAE,GAAU;YAChB;gBACE,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"settings.service.js","sourceRoot":"","sources":["../src/settings.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AAMjB,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,gBAA+B;QAC/C,MAAM,EAAE,GAAU;YAChB;gBACE,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE;aAC5C;SACF,CAAC;QAEF,IAAI,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE,CAAC;YACpD,KAAK,IAAI,CAAC,GAAG,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AM,CAAC;YACxC,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAa;QAC7B,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAC3B,iDAAiD,CAClD,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5C,KAAK,EAAE;gBACL,EAAE,EAAE;oBACF,EAAE,EAAE,GAAG;iBACR;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAxEY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,eAAe,CAwE3B"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hedhog/setting",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.5",
|
4
4
|
"private": false,
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"scripts": {
|
@@ -18,9 +18,9 @@
|
|
18
18
|
"bcrypt": "^5.1.1"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@hedhog/auth": "
|
22
|
-
"@hedhog/pagination": "
|
23
|
-
"@hedhog/prisma": "
|
21
|
+
"@hedhog/auth": "latest",
|
22
|
+
"@hedhog/pagination": "latest",
|
23
|
+
"@hedhog/prisma": "latest",
|
24
24
|
"ts-node": "^10.9.1",
|
25
25
|
"typescript": "^5.1.3"
|
26
26
|
}
|
package/src/migrations/index.ts
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
} from 'typeorm';
|
7
7
|
import { idColumn, timestampColumn } from '@hedhog/utils';
|
8
8
|
|
9
|
-
export class
|
9
|
+
export class Migrate implements MigrationInterface {
|
10
10
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
11
11
|
await queryRunner.createTable(
|
12
12
|
new Table({
|
@@ -51,6 +51,7 @@ export class CreateSettings1726152718000 implements MigrationInterface {
|
|
51
51
|
{
|
52
52
|
name: 'setting_id',
|
53
53
|
type: 'int',
|
54
|
+
unsigned: true,
|
54
55
|
},
|
55
56
|
timestampColumn(),
|
56
57
|
timestampColumn('updated_at'),
|
package/src/settings.service.ts
CHANGED
@@ -22,10 +22,18 @@ export class SettingsService {
|
|
22
22
|
async getSettings(paginationParams: PaginationDTO) {
|
23
23
|
const OR: any[] = [
|
24
24
|
{
|
25
|
-
name: { contains: paginationParams.search
|
25
|
+
name: { contains: paginationParams.search },
|
26
26
|
},
|
27
27
|
];
|
28
28
|
|
29
|
+
if (this.prismaService.getProvider() === 'postgres') {
|
30
|
+
for (let i = 0; i < OR.length; i++) {
|
31
|
+
for (let x = 0; x < Object.keys(OR[i]).length; x++) {
|
32
|
+
OR[i][Object.keys(OR[i])[x]].insensitive = true;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
29
37
|
if (!isNaN(+paginationParams.search)) {
|
30
38
|
OR.push({ id: { equals: +paginationParams.search } });
|
31
39
|
}
|