@epip/crud
Advanced tools
Comparing version 1.0.53 to 1.0.54
import { to } from "await-to-js"; | ||
import { DeepPartial, IsNull, Repository } from "typeorm"; | ||
import { IResponse, IResponseAll } from "../types"; | ||
import { Request } from "express"; | ||
@@ -8,3 +9,3 @@ export class BaseService<T> { | ||
public async getAll(): Promise<IResponseAll<T>> { | ||
public async getAll(req: Request): Promise<IResponseAll<T>> { | ||
const [err, results] = await to(this.repo.find({ | ||
@@ -29,3 +30,3 @@ where:{ | ||
public async get(id: number): Promise<IResponse<T>> { | ||
public async get(req: Request, id: number): Promise<IResponse<T>> { | ||
const [err, result] = await to( | ||
@@ -53,3 +54,3 @@ this.repo.findOne({ | ||
public async post(entity: T): Promise<IResponse<T>> { | ||
public async post(req: Request, entity: T): Promise<IResponse<T>> { | ||
(entity as any).insertedAt=new Date() | ||
@@ -71,5 +72,5 @@ const [err, result] = await to(this.repo.save(entity)); | ||
public async put(id: number, entity: T): Promise<IResponse<T>> { | ||
public async put(req: Request, id: number, entity: T): Promise<IResponse<T>> { | ||
(entity as any).insertedAt=new Date() | ||
let [err, results] = await to(this.get(id)); | ||
let [err, results] = await to(this.get(req, id)); | ||
if (err) { | ||
@@ -121,4 +122,4 @@ return { | ||
public async patch(id: number, entity: T): Promise<IResponse<T>> { | ||
let [err, results] = await to(this.get(id)); | ||
public async patch(req: Request, id: number, entity: T): Promise<IResponse<T>> { | ||
let [err, results] = await to(this.get(req, id)); | ||
if (err) { | ||
@@ -169,4 +170,4 @@ return { | ||
public async delete(id: number): Promise<IResponse<T>> { | ||
let [err, results] = await to(this.get(id)); | ||
public async delete(req: Request, id: number): Promise<IResponse<T>> { | ||
let [err, results] = await to(this.get(req, id)); | ||
if (err) { | ||
@@ -173,0 +174,0 @@ return { |
{ | ||
"name": "@epip/crud", | ||
"version": "1.0.53", | ||
"version": "1.0.54", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"express": "^4.17.1" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/common": "^8.0.6", | ||
"@nestjs/swagger": "^5.0.9", | ||
"@types/browserify": "latest", | ||
"@types/express": "^4.17.13", | ||
"await-to-js": "^3.0.0", | ||
"browserify": "latest", | ||
"typeorm": "^0.2.37", | ||
"typescript": "^4.4.2", | ||
"browserify": "latest", | ||
"@types/browserify": "latest" | ||
"typescript": "^4.4.2" | ||
}, | ||
@@ -16,0 +19,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258711
909
1
8
+ Addedexpress@^4.17.1
+ Addedaccepts@1.3.8(transitive)
+ Addedarray-flatten@1.1.1(transitive)
+ Addedbody-parser@1.20.3(transitive)
+ Addedbytes@3.1.2(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedcookie@0.7.1(transitive)
+ Addedcookie-signature@1.0.6(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddepd@2.0.0(transitive)
+ Addeddestroy@1.2.0(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedencodeurl@1.0.22.0.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedetag@1.8.1(transitive)
+ Addedexpress@4.21.1(transitive)
+ Addedfinalhandler@1.3.1(transitive)
+ Addedforwarded@0.2.0(transitive)
+ Addedfresh@0.5.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.1.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhttp-errors@2.0.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedipaddr.js@1.9.1(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmerge-descriptors@1.0.3(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedms@2.0.02.1.3(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedpath-to-regexp@0.1.10(transitive)
+ Addedproxy-addr@2.0.7(transitive)
+ Addedqs@6.13.0(transitive)
+ Addedrange-parser@1.2.1(transitive)
+ Addedraw-body@2.5.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsend@0.19.0(transitive)
+ Addedserve-static@1.16.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstatuses@2.0.1(transitive)
+ Addedtoidentifier@1.0.1(transitive)
+ Addedtype-is@1.6.18(transitive)
+ Addedunpipe@1.0.0(transitive)
+ Addedutils-merge@1.0.1(transitive)
+ Addedvary@1.1.2(transitive)