diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 000000000..2a1952310 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +node version/git-version.js diff --git a/.husky/pre-commit b/.husky/pre-commit index 1577fd5b5..9df0546ba 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/env sh -# . "$(dirname -- "$0")/_/husky.sh" +!/usr/bin/env sh + . "$(dirname -- "$0")/_/husky.sh" -#npm run build:version && git add version/git-version.ts +npm run build:version && git add version/git-version.ts diff --git a/gabinete.postman_collection.json b/gabinete.postman_collection.json new file mode 100644 index 000000000..c49113d9d --- /dev/null +++ b/gabinete.postman_collection.json @@ -0,0 +1,78 @@ +{ + "info": { + "_postman_id": "2be7c96a-9d34-45fe-9dc9-8fe62efaefbf", + "name": "gabinete", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "32154620" + }, + "item": [ + { + "name": "send notification to perter's phone", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "key=AAAAum9znm8:APA91bFtKgVFS7XhJrYkn1m6If3pLwHqCVDcpotFbk8qFtAg_3FdptH7BvOGVRBlX-0wdbSIV9uKhF7iogLLAo1-bf02FwRbeofnC-6JGC2IzFbWK_zto8wp1f5q_zrwkmU0s3wqksv6" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\"to\":\"fGrBJ52QRqG4rcuHur2_5l:APA91bGerKl6LcrqKjnG8Xvm-JaHxJfuMmKjYn7hJk-m5jhUAy2PIuhJ-yjkv0bGwPPKHeBAbYmDTB5zp_-D1sUetJJ8I8tPsP3pUl6nRRhDgPYO4N-97typ8wn5Le6xHK1ncFyOk2yR\",\r\n \"data\": {\r\n \"IdObject\": \"30847_101\",\r\n \"Service\": \"gabinete-digital\",\r\n \"Object\": \"despachos\",\r\n \"FolderId\": \"10469\"\r\n },\r\n \"notification\": {\r\n \"body\": \"Recebeu o Despacho nº 000025-0823 para vossa atenção\",\r\n \"title\": \"teste deferimento 11/02_1\"\r\n }\r\n}" + }, + "url": { + "raw": "https://fcm.googleapis.com/fcm/send", + "protocol": "https", + "host": [ + "fcm", + "googleapis", + "com" + ], + "path": [ + "fcm", + "send" + ] + } + }, + "response": [] + }, + { + "name": "send notification", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "key=AAAAum9znm8:APA91bFtKgVFS7XhJrYkn1m6If3pLwHqCVDcpotFbk8qFtAg_3FdptH7BvOGVRBlX-0wdbSIV9uKhF7iogLLAo1-bf02FwRbeofnC-6JGC2IzFbWK_zto8wp1f5q_zrwkmU0s3wqksv6" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n\"to\":\"ci3PSyhViJStOUiILtqYal:APA91bFJ-eGiCFeSt0ar2hC8UzNfRtcbAYN43frpmRfTBG4-vZO8Yxv1CoE2Bn5PJnmYo37s3RIp0s267p7Eq9V2ycbjBxRSdWVbuUSYHMFN-oqa5OXr6lsLqrSnNGVDwq_pNgGsIF7S\",\r\n\"notification\" : {\r\n \"body\" : \"Body of Your Notification\",\r\n \"title\": \"Title of Your Notification\"\r\n}\r\n}" + }, + "url": { + "raw": "https://fcm.googleapis.com/fcm/send", + "protocol": "https", + "host": [ + "fcm", + "googleapis", + "com" + ], + "path": [ + "fcm", + "send" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f72bdf905..d30077b9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -153,7 +153,7 @@ "hammerjs": "^2.0.8", "howler": "^2.2.3", "http-server": "^14.1.1", - "husky": "^8.0.2", + "husky": "^8.0.3", "ionic-angular": "^3.9.10", "ionic-image-loader": "^6.3.3", "ionic-image-loader-v5": "^1.0.2", @@ -18342,9 +18342,9 @@ } }, "node_modules/husky": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.2.tgz", - "integrity": "sha512-Tkv80jtvbnkK3mYWxPZePGFpQ/tT3HNSs/sasF9P2YfkMezDl3ON37YN6jUUI4eTg5LcyVynlb6r4eyvOmspvg==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", "bin": { "husky": "lib/bin.js" }, @@ -58132,9 +58132,9 @@ } }, "husky": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.2.tgz", - "integrity": "sha512-Tkv80jtvbnkK3mYWxPZePGFpQ/tT3HNSs/sasF9P2YfkMezDl3ON37YN6jUUI4eTg5LcyVynlb6r4eyvOmspvg==" + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==" }, "iconv-lite": { "version": "0.6.3", diff --git a/package.json b/package.json index 351b229b4..74a414585 100644 --- a/package.json +++ b/package.json @@ -169,7 +169,7 @@ "hammerjs": "^2.0.8", "howler": "^2.2.3", "http-server": "^14.1.1", - "husky": "^8.0.2", + "husky": "^8.0.3", "ionic-angular": "^3.9.10", "ionic-image-loader": "^6.3.3", "ionic-image-loader-v5": "^1.0.2", diff --git a/src/app/interceptors/metter.interceptor.ts b/src/app/interceptors/metter.interceptor.ts index 69302c281..c74247908 100644 --- a/src/app/interceptors/metter.interceptor.ts +++ b/src/app/interceptors/metter.interceptor.ts @@ -18,7 +18,7 @@ const metricReader = new PeriodicExportingMetricReader({ // } }), exportIntervalMillis: 1000, -}) +}); meterProvider.addMetricReader(metricReader); @@ -27,32 +27,29 @@ const requestCounter = meter.createCounter('post_requests', { description: 'Example of a Counter', }); - @Injectable() export class MetricsInterceptor implements HttpInterceptor { intercept(req: HttpRequest, next: HttpHandler): Observable> { - - return next.handle(req).pipe( tap(event => { if (event instanceof HttpResponse) { - // Capture the status code + // Capture the status code and check protocol if (req.method !== 'GET' && !req.urlWithParams.includes('metrics')) { const path = req.urlWithParams; const url = new URL(path); - let attributes = { path: url.pathname, method: req.method }; - const statusCode = event.status; - const extendedAttributes = { ...attributes, status: statusCode }; - requestCounter.add(1, extendedAttributes); + if (!window.location.origin.includes('https:')) { + let attributes = { path: url.pathname, method: req.method }; + const statusCode = event.status; + const extendedAttributes = { ...attributes, status: statusCode }; + requestCounter.add(1, extendedAttributes); + } } - } }) ); } } - export const metricsInterceptor = { provide: HTTP_INTERCEPTORS, useClass: MetricsInterceptor, diff --git a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts index 66a05eb4d..dbdb55028 100644 --- a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts +++ b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts @@ -186,6 +186,13 @@ export class AgendaDataRepositoryService { updateEvent(eventId, eventData, editAllEvent, calendar: TableSharedCalendar) { + let body; + if(typeof eventData?.Body == 'object') { + body = eventData?.Body?.Text + } else { + body = eventData?.Body + } + let eventInput = { userId: calendar.wxUserId, ownerType: this.utils.selectedCalendarOwner(calendar.role),