@hedhog/prisma 0.0.9 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -37,14 +37,14 @@ npm i @hedhog/prisma
37
37
 
38
38
  ```plaintext
39
39
  prisma/
40
- ├── dist/ # Compiled JavaScript files from build
40
+ ├── dist/ # Compiled JavaScript file from build
41
41
  ├── node_modules/ # Discardable folder with all module dependencies
42
42
  ├── src/
43
43
  │ ├── index.ts # Entry point for PrismaService
44
44
  │ ├── prisma.module.ts # Module definition (if needed)
45
45
  │ └── prisma.service.ts # Service class extending PrismaClient
46
46
  │ ├── prisma.service.spec.ts # Unit tests for PrismaService
47
- ├── .gitignore # Specifies which files Git should ignore
47
+ ├── .gitignore # Specifies which file Git should ignore
48
48
  ├── package.json # Manages dependencies and scripts for the library
49
49
  ├── package-lock.json # Lock file for dependencies
50
50
  ├── README.md # Documentation for the library
@@ -26,7 +26,7 @@ let PrismaService = class PrismaService extends client_1.PrismaClient {
26
26
  const searchValue = paginationParams.search;
27
27
  const OR = [];
28
28
  fields.forEach((field) => {
29
- if (field === 'id' && !isNaN(+searchValue)) {
29
+ if (field === 'id' && !isNaN(+searchValue) && +searchValue > 0) {
30
30
  OR.push({ id: { equals: +searchValue } });
31
31
  }
32
32
  else if (field === 'method' &&
@@ -41,7 +41,7 @@ let PrismaService = class PrismaService extends client_1.PrismaClient {
41
41
  OR.push(condition);
42
42
  }
43
43
  });
44
- if (!isNaN(+searchValue)) {
44
+ if (!isNaN(+searchValue) && +searchValue > 0) {
45
45
  OR.push({ id: { equals: +searchValue } });
46
46
  }
47
47
  return OR;
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,C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ClB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CACnE,WAAW,CACZ,EACD,CAAC;gBACD,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;YAC/C,CAAC;iBAAM,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC;gBAEzD,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;oBACrB,SAAS,CAAC,KAAK,CAAS,CAAC,IAAI,GAAG,aAAa,CAAC;gBACjD,CAAC;gBAED,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC;YAC7C,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAA;AAnDY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAmDzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/prisma",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './prisma.module';
2
2
  export * from './prisma.service';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1 @@
1
- export declare class PrismaModule {
2
- }
3
- //# sourceMappingURL=prisma.module.d.ts.map
1
+ export declare class PrismaModule {}
@@ -1,6 +1,4 @@
1
- import { OnModuleInit } from '@nestjs/common';
2
1
  import { PrismaClient } from '@prisma/client';
3
- export declare class PrismaService extends PrismaClient implements OnModuleInit {
4
- onModuleInit(): Promise<void>;
2
+ export declare class PrismaService extends PrismaClient {
3
+ onModuleInit(): Promise<void>;
5
4
  }
6
- //# sourceMappingURL=prisma.service.d.ts.map
@@ -27,7 +27,7 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
27
27
  const OR: any[] = [];
28
28
 
29
29
  fields.forEach((field) => {
30
- if (field === 'id' && !isNaN(+searchValue)) {
30
+ if (field === 'id' && !isNaN(+searchValue) && +searchValue > 0) {
31
31
  OR.push({ id: { equals: +searchValue } });
32
32
  } else if (
33
33
  field === 'method' &&
@@ -47,7 +47,7 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
47
47
  }
48
48
  });
49
49
 
50
- if (!isNaN(+searchValue)) {
50
+ if (!isNaN(+searchValue) && +searchValue > 0) {
51
51
  OR.push({ id: { equals: +searchValue } });
52
52
  }
53
53
 
@@ -1,18 +0,0 @@
1
- import { Test, TestingModule } from '@nestjs/testing';
2
- import { PrismaService } from './prisma.service';
3
-
4
- describe('PrismaService', () => {
5
- let service: PrismaService;
6
-
7
- beforeEach(async () => {
8
- const module: TestingModule = await Test.createTestingModule({
9
- providers: [PrismaService],
10
- }).compile();
11
-
12
- service = module.get<PrismaService>(PrismaService);
13
- });
14
-
15
- it('should be defined', () => {
16
- expect(service).toBeDefined();
17
- });
18
- });