fiscalia_bo-nest-helpers 0.1.68 → 0.1.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -56
- package/dist/ms-seguridad/Seguridad.pb.d.ts +10 -0
- package/dist/ms-seguridad/Seguridad.pb.js +1 -0
- package/dist/ms-seguridad/Seguridad.pb.js.map +1 -1
- package/dist/ms-seguridad/Seguridad.proto +13 -2
- package/dist/ms-seguridad/ms-seguridad.decorator.d.ts +5 -2
- package/dist/ms-seguridad/ms-seguridad.decorator.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -102,13 +102,15 @@ En este ejemplo, estamos utilizando el método register para cargar la configura
|
|
102
102
|
|
103
103
|
- `@AuthUser()`, decorador para obtener los datos del token como ser:
|
104
104
|
- ci: string;
|
105
|
-
-
|
106
|
-
- idFuncionario: number;
|
107
|
-
- idPersona: number;
|
105
|
+
- aplicacionId: number;
|
108
106
|
- usuarioId: number;
|
109
|
-
- perfilPersonaId: number;
|
110
|
-
- institucionId: number;
|
111
107
|
- msPersonaId: number;
|
108
|
+
- perfilPersonaId: number;
|
109
|
+
- funcionarioId?: number;
|
110
|
+
- oficinaId?: number;
|
111
|
+
- municipioId?: number;
|
112
|
+
- institucionId?: number;
|
113
|
+
- departamentoId?: number;
|
112
114
|
- `@AuthToken()`, decorador para obtener el token de tipo string
|
113
115
|
|
114
116
|
- `@AuthPermissions()`, decorador para obtener la lista de permisos, devuelve array de string.
|
@@ -166,11 +168,12 @@ export class AppModule {}
|
|
166
168
|
```
|
167
169
|
|
168
170
|
Configuracion de Paquete en el archivo my.montroller.ts
|
171
|
+
|
169
172
|
```typescript
|
170
173
|
import { DatapassInterceptor } from 'ms-redis-cliente'
|
171
174
|
|
172
|
-
@Get('/my-rest-api')
|
173
|
-
@SetMetadata("data-cache", {key:"key-name-cache",ttl:15})
|
175
|
+
@Get('/my-rest-api')
|
176
|
+
@SetMetadata("data-cache", {key:"key-name-cache",ttl:15})
|
174
177
|
@UseInterceptors(DatapassInterceptor)
|
175
178
|
/*Configuracion de Res() obligatoria
|
176
179
|
{ passthrough: true }
|
@@ -252,94 +255,85 @@ export class AppModule {}
|
|
252
255
|
|
253
256
|
En este ejemplo, estamos utilizando el método register para cargar la configuración de forma `síncrona`
|
254
257
|
|
255
|
-
# USO DEL MODULO `MS-PERSONAS`
|
256
|
-
|
257
|
-
## Configuracion
|
258
|
-
|
259
258
|
# USO DEL MODULO `MS-RABBITMQ`
|
260
259
|
|
261
|
-
|
262
260
|
Configuracion de Paquete en el archivo app.module.ts
|
261
|
+
|
263
262
|
```typescript
|
264
|
-
import {MsRabbitModule} from 'fiscalia_bo-nest-helpers';
|
263
|
+
import { MsRabbitModule } from 'fiscalia_bo-nest-helpers';
|
265
264
|
@Module({
|
266
265
|
imports: [
|
267
266
|
MsRabbitModule.register({
|
268
|
-
global:true,
|
269
|
-
urlRabbit:process.env.SERVICE_MS_RABBIT_URL
|
270
|
-
})
|
271
|
-
|
267
|
+
global: true,
|
268
|
+
urlRabbit: process.env.SERVICE_MS_RABBIT_URL,
|
269
|
+
}),
|
270
|
+
],
|
271
|
+
controllers: [],
|
272
272
|
providers: [],
|
273
273
|
})
|
274
274
|
export class AppModule {}
|
275
|
-
|
276
275
|
```
|
277
276
|
|
277
|
+
Configuracion para escuchar un canal especifico de rabbit
|
278
278
|
|
279
|
-
Configuracion para escuchar un canal especifico de rabbit
|
280
279
|
```typescript
|
281
|
-
import {MsRabbitService } from 'fiscalia_bo-nest-helpers';
|
280
|
+
import { MsRabbitService } from 'fiscalia_bo-nest-helpers';
|
282
281
|
@Injectable()
|
283
282
|
export class AppService {
|
284
|
-
constructor(
|
285
|
-
|
286
|
-
){}
|
287
|
-
async onModuleInit(){
|
283
|
+
constructor(private readonly msRabbitService: MsRabbitService) {}
|
284
|
+
async onModuleInit() {
|
288
285
|
try {
|
289
|
-
await this.msRabbitService.listenQueueMsRabbit(
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
286
|
+
await this.msRabbitService.listenQueueMsRabbit(
|
287
|
+
{ virtualhost: 'blade_host_virtual', queueListen: 'tasks' },
|
288
|
+
(error, result) => {
|
289
|
+
if (error) {
|
290
|
+
console.log(error);
|
291
|
+
} else {
|
292
|
+
console.log('>>>', result);
|
293
|
+
}
|
294
|
+
},
|
295
|
+
);
|
297
296
|
} catch (error) {
|
298
|
-
console.log(error)
|
297
|
+
console.log(error);
|
299
298
|
}
|
300
|
-
|
301
299
|
}
|
302
300
|
}
|
303
301
|
```
|
304
302
|
|
305
303
|
## Parametros para utilizar el metodo listenQueueMsRabbit
|
306
304
|
|
307
|
-
| Propiedad
|
308
|
-
|
|
309
|
-
| virtualHost | String (null) | Host Virtual donde creara una conexion, si este se envia null lo creara automaticamete
|
310
|
-
| queueListen | String (null) | El canal o queue que desea que escuchar y recibir datos|
|
311
|
-
| callback
|
312
|
-
|
313
|
-
|
305
|
+
| Propiedad | Valor | Descripcion |
|
306
|
+
| ----------- | ------------- | -------------------------------------------------------------------------------------- |
|
307
|
+
| virtualHost | String (null) | Host Virtual donde creara una conexion, si este se envia null lo creara automaticamete |
|
308
|
+
| queueListen | String (null) | El canal o queue que desea que escuchar y recibir datos |
|
309
|
+
| callback | Function | Campo necesario para pode recibir en el callback los datos transmitidos |
|
314
310
|
|
315
311
|
## Parametros para utilizar el metodo senderQueueMsRabbit
|
316
312
|
|
317
|
-
Se pueden utilizar el servicio
|
313
|
+
Se pueden utilizar el servicio
|
318
314
|
|
319
315
|
Debe realizar la configuracion de Paquete en su archivo my.service.ts
|
316
|
+
|
320
317
|
```typescript
|
321
318
|
import { RabbitServiceClient } from 'ms-rabbit-cliente';
|
322
319
|
|
323
320
|
@Injectable()
|
324
321
|
export class AppService {
|
325
|
-
constructor(
|
326
|
-
private rabbitServiceClient:RabbitServiceClient,
|
327
|
-
){}
|
328
|
-
|
329
|
-
|
330
|
-
async MyService(){
|
331
|
-
await this.msRabbitService.senderQueueMsRabbit({virtualhost:"blade_host_virtual",queueListen:'tasks'},JSON.stringify({a:"holamundo"}))
|
322
|
+
constructor(private rabbitServiceClient: RabbitServiceClient) {}
|
332
323
|
|
324
|
+
async MyService() {
|
325
|
+
await this.msRabbitService.senderQueueMsRabbit(
|
326
|
+
{ virtualhost: 'blade_host_virtual', queueListen: 'tasks' },
|
327
|
+
JSON.stringify({ a: 'holamundo' }),
|
328
|
+
);
|
333
329
|
}
|
334
330
|
}
|
335
|
-
|
336
331
|
```
|
337
332
|
|
338
|
-
|
339
333
|
Descripcion de los objecto para envio de datos
|
340
334
|
|
341
|
-
| Propiedad
|
342
|
-
|
|
343
|
-
| virtualHost | String (null) | Host Virtual donde creara una conexion, si este se envia null lo creara automaticamete
|
344
|
-
| queueListen | String (null) | El canal o queue que desea transmitir datos|
|
345
|
-
| data
|
335
|
+
| Propiedad | Valor | Descripcion |
|
336
|
+
| ----------- | ------------- | -------------------------------------------------------------------------------------- |
|
337
|
+
| virtualHost | String (null) | Host Virtual donde creara una conexion, si este se envia null lo creara automaticamete |
|
338
|
+
| queueListen | String (null) | El canal o queue que desea transmitir datos |
|
339
|
+
| data | String | Campo necesario para enviar datos en formato Json String |
|
@@ -9,6 +9,10 @@ export interface LoginConvenioBody {
|
|
9
9
|
fechaNacimiento: string;
|
10
10
|
intitucionIdentificador: string;
|
11
11
|
}
|
12
|
+
export interface VerificarCuotaBody {
|
13
|
+
token: string;
|
14
|
+
servicio: string;
|
15
|
+
}
|
12
16
|
export interface TokenBody {
|
13
17
|
token: string;
|
14
18
|
}
|
@@ -86,6 +90,9 @@ export interface ResponseUserData_UserPayload {
|
|
86
90
|
perfilPersonaId: number;
|
87
91
|
ci: string;
|
88
92
|
institucionId?: number | undefined;
|
93
|
+
oficinaId?: number | undefined;
|
94
|
+
municipioId?: number | undefined;
|
95
|
+
departamentoId?: number | undefined;
|
89
96
|
}
|
90
97
|
export interface LogoutResponse {
|
91
98
|
error: boolean;
|
@@ -220,6 +227,7 @@ export interface InformacionConvenioResponse_Convenio {
|
|
220
227
|
fechaFin: string;
|
221
228
|
}
|
222
229
|
export interface InformacionConvenioResponse_Institucion {
|
230
|
+
id: number;
|
223
231
|
nombre: string;
|
224
232
|
identificador: string;
|
225
233
|
}
|
@@ -248,6 +256,7 @@ export interface seguridadServiceClient {
|
|
248
256
|
convenioLog(request: ConvenioLogBody): Observable<ConvenioLogResponse>;
|
249
257
|
convenioTokenInformation(request: TokenBody): Observable<InformacionConvenioResponse>;
|
250
258
|
convenioTokenValidar(request: TokenBody): Observable<ConvenioTokenValidResponse>;
|
259
|
+
convenioVerificarCuota(request: VerificarCuotaBody): Observable<ConvenioTokenValidResponse>;
|
251
260
|
convenioTokenServicios(request: TokenBody): Observable<ResponseServicioTokenConvenio>;
|
252
261
|
validToken(request: TokenBody): Observable<ResponseValidToken>;
|
253
262
|
login(request: LoginRequest): Observable<LoginResponse>;
|
@@ -264,6 +273,7 @@ export interface seguridadServiceController {
|
|
264
273
|
convenioLog(request: ConvenioLogBody): Promise<ConvenioLogResponse> | Observable<ConvenioLogResponse> | ConvenioLogResponse;
|
265
274
|
convenioTokenInformation(request: TokenBody): Promise<InformacionConvenioResponse> | Observable<InformacionConvenioResponse> | InformacionConvenioResponse;
|
266
275
|
convenioTokenValidar(request: TokenBody): Promise<ConvenioTokenValidResponse> | Observable<ConvenioTokenValidResponse> | ConvenioTokenValidResponse;
|
276
|
+
convenioVerificarCuota(request: VerificarCuotaBody): Promise<ConvenioTokenValidResponse> | Observable<ConvenioTokenValidResponse> | ConvenioTokenValidResponse;
|
267
277
|
convenioTokenServicios(request: TokenBody): Promise<ResponseServicioTokenConvenio> | Observable<ResponseServicioTokenConvenio> | ResponseServicioTokenConvenio;
|
268
278
|
validToken(request: TokenBody): Promise<ResponseValidToken> | Observable<ResponseValidToken> | ResponseValidToken;
|
269
279
|
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Seguridad.pb.js","sourceRoot":"","sources":["../../src/ms-seguridad/Seguridad.pb.ts"],"names":[],"mappings":";;;AACA,yDAAqE;AAGxD,QAAA,eAAe,GAAG,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"Seguridad.pb.js","sourceRoot":"","sources":["../../src/ms-seguridad/Seguridad.pb.ts"],"names":[],"mappings":";;;AACA,yDAAqE;AAGxD,QAAA,eAAe,GAAG,oBAAoB,CAAC;AA+RvC,QAAA,+BAA+B,GAAG,oBAAoB,CAAC;AA0FpE,SAAgB,iCAAiC;IAC/C,OAAO,UAAU,WAAqB;QACpC,MAAM,WAAW,GAAa;YAC5B,iBAAiB;YACjB,cAAc;YACd,eAAe;YACf,gBAAgB;YAChB,aAAa;YACb,0BAA0B;YAC1B,sBAAsB;YACtB,wBAAwB;YACxB,wBAAwB;YACxB,YAAY;YACZ,OAAO;YACP,kBAAkB;YAClB,QAAQ;YACR,iBAAiB;YACjB,YAAY;SACb,CAAC;QACF,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE;YAChC,MAAM,UAAU,GAAQ,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACxF,IAAA,0BAAU,EAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;SAC3F;QACD,MAAM,iBAAiB,GAAa,EAAE,CAAC;QACvC,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE;YACtC,MAAM,UAAU,GAAQ,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACxF,IAAA,gCAAgB,EAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;SACjG;IACH,CAAC,CAAC;AACJ,CAAC;AA7BD,8EA6BC;AAEY,QAAA,sBAAsB,GAAG,kBAAkB,CAAC"}
|
@@ -21,6 +21,7 @@ service seguridadService {
|
|
21
21
|
rpc ConvenioLog (ConvenioLogBody) returns (ConvenioLogResponse);
|
22
22
|
rpc ConvenioTokenInformation (TokenBody) returns (InformacionConvenioResponse);
|
23
23
|
rpc ConvenioTokenValidar (TokenBody) returns (ConvenioTokenValidResponse);
|
24
|
+
rpc ConvenioVerificarCuota (VerificarCuotaBody) returns (ConvenioTokenValidResponse);
|
24
25
|
rpc ConvenioTokenServicios (TokenBody) returns (ResponseServicioTokenConvenio);
|
25
26
|
|
26
27
|
rpc ValidToken (TokenBody) returns (ResponseValidToken);
|
@@ -32,6 +33,11 @@ service seguridadService {
|
|
32
33
|
}
|
33
34
|
|
34
35
|
//SECTION - input a data para servicios
|
36
|
+
message VerificarCuotaBody {
|
37
|
+
string token = 1;
|
38
|
+
string servicio = 2;
|
39
|
+
}
|
40
|
+
|
35
41
|
message TokenBody {
|
36
42
|
string token = 1;
|
37
43
|
}
|
@@ -124,6 +130,9 @@ message ResponseUserData {
|
|
124
130
|
int32 perfilPersonaId= 5;
|
125
131
|
string ci = 6;
|
126
132
|
optional int32 institucionId = 7;
|
133
|
+
optional int32 oficinaId = 8;
|
134
|
+
optional int32 municipioId = 9;
|
135
|
+
optional int32 departamentoId = 10;
|
127
136
|
}
|
128
137
|
}
|
129
138
|
|
@@ -277,9 +286,11 @@ message InformacionConvenioResponse {
|
|
277
286
|
string fechaInicio = 2;
|
278
287
|
string fechaFin = 3;
|
279
288
|
}
|
289
|
+
|
280
290
|
message Institucion {
|
281
|
-
|
282
|
-
string
|
291
|
+
int32 id = 1;
|
292
|
+
string nombre = 2;
|
293
|
+
string identificador = 3;
|
283
294
|
}
|
284
295
|
}
|
285
296
|
|
@@ -2,11 +2,14 @@ export declare const BearerAuthPermision: (permissions?: string[]) => <TFunction
|
|
2
2
|
export declare class UserPayload {
|
3
3
|
ci: string;
|
4
4
|
aplicacionId: number;
|
5
|
-
funcionarioId: number;
|
6
5
|
usuarioId: number;
|
7
6
|
msPersonaId: number;
|
8
|
-
institucionId: number;
|
9
7
|
perfilPersonaId: number;
|
8
|
+
funcionarioId?: number;
|
9
|
+
oficinaId?: number;
|
10
|
+
municipioId?: number;
|
11
|
+
institucionId?: number;
|
12
|
+
departamentoId?: number;
|
10
13
|
}
|
11
14
|
export declare const AuthUser: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
12
15
|
export declare const AuthToken: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ms-seguridad.decorator.js","sourceRoot":"","sources":["../../src/ms-seguridad/ms-seguridad.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAoG;AACpG,6CAAgD;AAChD,yDAAoD;AACpD,uDAA0E;AAEnE,MAAM,mBAAmB,GAAG,CAAC,WAAsB,EAAE,EAAE;IAC5D,MAAM,UAAU,GAAG,CAAC,IAAA,uBAAa,GAAE,EAAE,IAAA,kBAAS,EAAC,iCAAc,EAAE,kCAAgB,CAAC,CAAC,CAAC;IAElF,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QACzC,UAAU,CAAC,IAAI,CAAC,IAAA,qCAAmB,EAAC,GAAG,WAAW,CAAC,CAAC,CAAC;KACtD;IACD,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC,CAAC;AAPW,QAAA,mBAAmB,uBAO9B;AAEF,MAAa,WAAW;
|
1
|
+
{"version":3,"file":"ms-seguridad.decorator.js","sourceRoot":"","sources":["../../src/ms-seguridad/ms-seguridad.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAoG;AACpG,6CAAgD;AAChD,yDAAoD;AACpD,uDAA0E;AAEnE,MAAM,mBAAmB,GAAG,CAAC,WAAsB,EAAE,EAAE;IAC5D,MAAM,UAAU,GAAG,CAAC,IAAA,uBAA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