add husky

This commit is contained in:
Peter Maquiran
2024-06-21 14:35:50 +01:00
parent 3b6da3d2c7
commit 4d400e1f8b
7 changed files with 108 additions and 22 deletions
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
node version/git-version.js
+3 -3
View File
@@ -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
+78
View File
@@ -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": []
}
]
}
+7 -7
View File
@@ -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",
+1 -1
View File
@@ -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",
+4 -7
View File
@@ -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<any>, next: HttpHandler): Observable<HttpEvent<any>> {
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);
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,
@@ -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),