@laboratory-one/api-components 0.0.3 → 0.0.5
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/dist/cjs/health/dtos/health.response.dto.d.ts +1 -2
- package/dist/cjs/health/dtos/health.response.dto.d.ts.map +1 -1
- package/dist/cjs/health/dtos/health.response.dto.js.map +1 -1
- package/dist/cjs/health/health.service.d.ts +2 -3
- package/dist/cjs/health/health.service.d.ts.map +1 -1
- package/dist/cjs/health/health.service.js +1 -4
- package/dist/cjs/health/health.service.js.map +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/index.d.ts.map +1 -1
- package/dist/cjs/services/index.js.map +1 -1
- package/dist/cjs/services/instrument-sentry.d.ts.map +1 -1
- package/dist/cjs/services/instrument-sentry.js.map +1 -1
- package/dist/cjs/user/dtos/index.js.map +1 -1
- package/dist/cjs/user/user.controller.d.ts.map +1 -1
- package/dist/cjs/user/user.controller.js.map +1 -1
- package/dist/cjs/utils/datetime.d.ts +1 -1
- package/dist/cjs/utils/datetime.d.ts.map +1 -1
- package/dist/cjs/utils/datetime.js.map +1 -1
- package/dist/cjs/utils/index.d.ts.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/health/dtos/health.response.dto.d.ts +1 -2
- package/dist/esm/health/dtos/health.response.dto.d.ts.map +1 -1
- package/dist/esm/health/dtos/health.response.dto.js.map +1 -1
- package/dist/esm/health/health.service.d.ts +2 -3
- package/dist/esm/health/health.service.d.ts.map +1 -1
- package/dist/esm/health/health.service.js +2 -5
- package/dist/esm/health/health.service.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/index.d.ts.map +1 -1
- package/dist/esm/services/index.js.map +1 -1
- package/dist/esm/services/instrument-sentry.d.ts.map +1 -1
- package/dist/esm/services/instrument-sentry.js.map +1 -1
- package/dist/esm/user/dtos/index.js.map +1 -1
- package/dist/esm/user/user.controller.d.ts.map +1 -1
- package/dist/esm/user/user.controller.js +2 -2
- package/dist/esm/user/user.controller.js.map +1 -1
- package/dist/esm/utils/datetime.d.ts +1 -1
- package/dist/esm/utils/datetime.d.ts.map +1 -1
- package/dist/esm/utils/datetime.js +1 -1
- package/dist/esm/utils/datetime.js.map +1 -1
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/health/dtos/health.response.dto.ts +5 -5
- package/src/health/health.service.ts +1 -4
- package/src/index.ts +12 -12
- package/src/services/index.ts +1 -1
- package/src/services/instrument-sentry.ts +3 -3
- package/src/user/dtos/index.ts +0 -1
- package/src/user/user.controller.ts +7 -2
- package/src/utils/datetime.ts +2 -2
- package/src/utils/index.ts +4 -4
- package/dist/cjs/enums/onboarding-status.enum.d.ts +0 -7
- package/dist/cjs/enums/onboarding-status.enum.d.ts.map +0 -1
- package/dist/cjs/enums/onboarding-status.enum.js +0 -11
- package/dist/cjs/enums/onboarding-status.enum.js.map +0 -1
- package/dist/esm/enums/onboarding-status.enum.d.ts +0 -7
- package/dist/esm/enums/onboarding-status.enum.d.ts.map +0 -1
- package/dist/esm/enums/onboarding-status.enum.js +0 -11
- package/dist/esm/enums/onboarding-status.enum.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HealthCheckResult, HealthCheckStatus } from '@nestjs/terminus
|
|
2
|
-
import { HealthIndicatorResult } from '@nestjs/terminus/dist/health-indicator';
|
|
1
|
+
import type { HealthCheckResult, HealthCheckStatus, HealthIndicatorResult } from '@nestjs/terminus';
|
|
3
2
|
export declare class HealthResponseDto implements HealthCheckResult {
|
|
4
3
|
status: HealthCheckStatus;
|
|
5
4
|
info?: HealthIndicatorResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.response.dto.d.ts","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.response.dto.d.ts","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,iBAAiB;IAEzD,MAAM,EAAE,iBAAiB,CAAC;IAG1B,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAG7B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAG9B,OAAO,EAAE,qBAAqB,CAAC;IAI/B,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.response.dto.js","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"health.response.dto.js","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":";;;;AAAA,qDAA2C;AAC3C,6CAA8C;AAO9C,MAAa,iBAAiB;CAgB7B;AAhBD,8CAgBC;AAdC;IADC,IAAA,qBAAW,GAAE;;iDACY;AAG1B;IADC,IAAA,qBAAW,GAAE;;+CACe;AAG7B;IADC,IAAA,qBAAW,GAAE;;gDACgB;AAG9B;IADC,IAAA,qBAAW,GAAE;;kDACiB;AAI/B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sDACM","sourcesContent":["import { IsString } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\nimport type {\n HealthCheckResult,\n HealthCheckStatus,\n HealthIndicatorResult,\n} from '@nestjs/terminus';\n\nexport class HealthResponseDto implements HealthCheckResult {\n @ApiProperty()\n status: HealthCheckStatus;\n\n @ApiProperty()\n info?: HealthIndicatorResult;\n\n @ApiProperty()\n error?: HealthIndicatorResult;\n\n @ApiProperty()\n details: HealthIndicatorResult;\n\n @IsString()\n @ApiProperty()\n environment: string;\n}\n"]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { HealthCheckService,
|
|
1
|
+
import { HealthCheckService, MemoryHealthIndicator } from '@nestjs/terminus';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
3
|
import { HealthResponseDto } from './dtos/health.response.dto';
|
|
4
4
|
export declare class HealthService {
|
|
5
5
|
private readonly configService;
|
|
6
6
|
private readonly health;
|
|
7
|
-
private readonly http;
|
|
8
7
|
private readonly memory;
|
|
9
8
|
private readonly logger;
|
|
10
|
-
constructor(configService: ConfigService, health: HealthCheckService,
|
|
9
|
+
constructor(configService: ConfigService, health: HealthCheckService, memory: MemoryHealthIndicator);
|
|
11
10
|
check(): Promise<HealthResponseDto>;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=health.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.service.d.ts","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"health.service.d.ts","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,qBACa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;gBAG9C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,qBAAqB;IAG1C,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAgB1C"}
|
|
@@ -7,17 +7,15 @@ const common_1 = require("@nestjs/common");
|
|
|
7
7
|
const terminus_1 = require("@nestjs/terminus");
|
|
8
8
|
const config_1 = require("@nestjs/config");
|
|
9
9
|
let HealthService = HealthService_1 = class HealthService {
|
|
10
|
-
constructor(configService, health,
|
|
10
|
+
constructor(configService, health, memory) {
|
|
11
11
|
this.configService = configService;
|
|
12
12
|
this.health = health;
|
|
13
|
-
this.http = http;
|
|
14
13
|
this.memory = memory;
|
|
15
14
|
this.logger = new common_1.Logger(HealthService_1.name);
|
|
16
15
|
}
|
|
17
16
|
async check() {
|
|
18
17
|
this.logger.log('check');
|
|
19
18
|
const statuses = await this.health.check([
|
|
20
|
-
async () => this.http.pingCheck('website', 'https://google.com'),
|
|
21
19
|
async () => this.memory.checkHeap('memoryHeap', 200 * 1024 * 1024),
|
|
22
20
|
async () => this.memory.checkRSS('memoryRss', 3000 * 1024 * 1024),
|
|
23
21
|
]);
|
|
@@ -30,7 +28,6 @@ exports.HealthService = HealthService = HealthService_1 = tslib_1.__decorate([
|
|
|
30
28
|
(0, common_1.Injectable)(),
|
|
31
29
|
tslib_1.__metadata("design:paramtypes", [config_1.ConfigService,
|
|
32
30
|
terminus_1.HealthCheckService,
|
|
33
|
-
terminus_1.HttpHealthIndicator,
|
|
34
31
|
terminus_1.MemoryHealthIndicator])
|
|
35
32
|
], HealthService);
|
|
36
33
|
//# sourceMappingURL=health.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.service.js","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAI0B;AAC1B,2CAA+C;
|
|
1
|
+
{"version":3,"file":"health.service.js","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAI0B;AAC1B,2CAA+C;AAOxC,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIxB,YACmB,aAA4B,EAC5B,MAA0B,EAC1B,MAA6B;QAF7B,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAoB;QAC1B,WAAM,GAAN,MAAM,CAAuB;QAL/B,WAAM,GAAW,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAM9D,CAAC;IAEJ,KAAK,CAAC,KAAK;QAET,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,QAAQ,GAAsB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1D,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;YAClE,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;SAClE,CAAC,CAAC;QAEH,MAAM,WAAW,GAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,UAAU,CAAC,CAAC;QAEvE,uBACE,WAAW,IACR,QAAQ,EACX;IACJ,CAAC;CACF,CAAA;AA1BY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;6CAMuB,sBAAa;QACpB,6BAAkB;QAClB,gCAAqB;GAPrC,aAAa,CA0BzB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport {\n HealthCheckResult,\n HealthCheckService,\n MemoryHealthIndicator,\n} from '@nestjs/terminus';\nimport { ConfigService } from '@nestjs/config';\n\nimport { HealthResponseDto } from './dtos/health.response.dto';\n\n// this decorator indicates to nest that this class can be provided to a module\n// we want to handle logic in services to keep our resolvers and controllers clean\n@Injectable()\nexport class HealthService {\n // grab the global logger instance\n private readonly logger: Logger = new Logger(HealthService.name);\n\n constructor(\n private readonly configService: ConfigService,\n private readonly health: HealthCheckService,\n private readonly memory: MemoryHealthIndicator,\n ) {}\n\n async check(): Promise<HealthResponseDto> {\n // this logger has several logging levels\n this.logger.log('check');\n\n const statuses: HealthCheckResult = await this.health.check([\n async () => this.memory.checkHeap('memoryHeap', 200 * 1024 * 1024),\n async () => this.memory.checkRSS('memoryRss', 3000 * 1024 * 1024),\n ]);\n\n const environment: string = this.configService.get<string>('NODE_ENV');\n\n return {\n environment,\n ...statuses,\n };\n }\n}\n"]}
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,kDAAwB;AACxB,kDAAwB;AACxB,mDAAyB;AACzB,uDAA6B;AAC7B,mDAAyB;AACzB,iDAAuB;AACvB,mDAAyB;AACzB,qDAA2B;AAC3B,kDAAwB;AACxB,iDAAuB;AACvB,kDAAwB","sourcesContent":["export * from './auth';\nexport * from './enums';\nexport * from './guard';\nexport * from './health';\nexport * from './middleware';\nexport * from './prisma';\nexport * from './push';\nexport * from './search';\nexport * from './services';\nexport * from './types';\nexport * from './user';\nexport * from './utils';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC","sourcesContent":["export * from './instrument-sentry';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAetB,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAetB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":";;;;AAAA,6DAAuC;AACvC,2DAAkE;AAE3D,MAAM,UAAU,GAAG,GAAG,EAAE;IAE7B,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,YAAY,EAAE;YAEZ,IAAA,yCAAwB,GAAE;SAC3B;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":";;;;AAAA,6DAAuC;AACvC,2DAAkE;AAE3D,MAAM,UAAU,GAAG,GAAG,EAAE;IAE7B,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,YAAY,EAAE;YAEZ,IAAA,yCAAwB,GAAE;SAC3B;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,UAAU,cAerB","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';\n\nexport const initSentry = () => {\n // Ensure to call this before requiring any other modules!\n Sentry.init({\n dsn: process.env.SENTRY_DSN,\n integrations: [\n // Add our Profiling integration\n nodeProfilingIntegration(),\n ],\n // Add Tracing by setting tracesSampleRate\n // We recommend adjusting this value in production\n tracesSampleRate: 1.0,\n // Set sampling rate for profiling\n // This is relative to tracesSampleRate\n profilesSampleRate: 1.0,\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["user/dtos/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,iEAAuC;AACvC,kEAAwC;AACxC,oEAA0C","sourcesContent":["export * from './get-user.response.dto';\nexport * from './register.request.dto';\nexport * from './register.response.dto';\nexport * from './update-user.request.dto';\n
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["user/dtos/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,iEAAuC;AACvC,kEAAwC;AACxC,oEAA0C","sourcesContent":["export * from './get-user.response.dto';\nexport * from './register.request.dto';\nexport * from './register.response.dto';\nexport * from './update-user.request.dto';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.d.ts","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW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AG,EAAE,oBAAoB,EACtB,GAAG,KAAA,GACb,OAAO,CAAC,kBAAkB,CAAC;IAmCxB,QAAQ,CAAY,GAAG,KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.js","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAOwB;AACxB,qCAAyC;AACzC,6CAAuD;AACvD,2CAAwD;AAGxD,uDAAmD;AACnD,iDAA6C;AAC7C,wEAAkE;AAClE,4EAAsE;AACtE,wEAAmE;AACnE,sEAAiE;AACjE,uDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"user.controller.js","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAOwB;AACxB,qCAAyC;AACzC,6CAAuD;AACvD,2CAAwD;AAGxD,uDAAmD;AACnD,iDAA6C;AAC7C,wEAAkE;AAClE,4EAAsE;AACtE,wEAAmE;AACnE,sEAAiE;AACjE,uDAAmD;AACnD,oCAKkB;AAClB,oCAAqC;AAI9B,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YACU,WAAwB,EACxB,WAAwB,EACxB,WAAwB,EACxB,UAAsB;QAHtB,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;IAC7B,CAAC;IAQE,AAAN,KAAK,CAAC,MAAM,CAAS,GAAuB;QAC1C,MAAM,UAAU,GAAuB;YACrC,KAAK,EAAE,IAAA,+BAAuB,EAAC,GAAG,CAAC,KAAK,CAAC;YACzC,QAAQ,EAAE,IAAA,mBAAW,EAAC,GAAG,CAAC,QAAQ,CAAC;SACpC,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,GAAG,GAAY,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAE/D,I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E,0BAA0B;QACvC,IAAI,EAAE,2CAAmB;KAC1B,CAAC;IACW,mBAAA,IAAA,aAAI,GAAE,CAAA;;6CAAM,yCAAkB;;2CAyB1C;AASK;IAPL,IAAA,kBAAS,EAAC,iBAAS,CAAC;IACpB,IAAA,YAAG,EAAC,MAAM,CAAC;IACX,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,0CAAkB;KACzB,CAAC;IACa,mBAAA,IAAA,gBAAO,GAAE,CAAA;;;;6CAUvB;AASK;IAPL,IAAA,kBAAS,EAAC,iBAAS,CAAC;IACpB,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE,0CAAkB;KACzB,CAAC;IAEC,mBAAA,IAAA,aAAI,GAAE,CAAA;IACN,mBAAA,IAAA,gBAAO,GAAE,CAAA;;6CADG,8CAAoB;;0CA6BlC;AAQK;IANL,IAAA,kBAAS,EAAC,iBAAS,CAAC;IACpB,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,sBAAsB;KACpC,CAAC;IACc,mBAAA,IAAA,gBAAO,GAAE,CAAA;;;;8CAgBxB;yBApKU,cAAc;IAF1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;6CAGM,0BAAW;QACX,0BAAW;QACX,0BAAW;QACZ,gBAAU;GALrB,cAAc,CAqK1B","sourcesContent":["import {\n Body,\n Controller,\n Get,\n Post,\n Request,\n UseGuards,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { ApiResponse, ApiTags } from '@nestjs/swagger';\nimport { OnboardingStatus, User } from '@prisma/client';\nimport { ExpoPushMessage } from 'expo-server-sdk';\n\nimport { AuthService } from '../auth/auth.service';\nimport { UserService } from './user.service';\nimport { GetUserResponseDto } from './dtos/get-user.response.dto';\nimport { UpdateUserRequestDto } from './dtos/update-user.request.dto';\nimport { RegisterResponseDto } from './dtos/register.response.dto';\nimport { RegisterRequestDto } from './dtos/register.request.dto';\nimport { PushService } from '../push/push.service';\nimport {\n cleanPhoneNumber,\n cleanString,\n cleanStringAndLowercase,\n handleError,\n} from '../utils';\nimport { AuthGuard } from '../guard';\n\n@ApiTags('User')\n@Controller('user')\nexport class UserController {\n constructor(\n private userService: UserService,\n private authService: AuthService,\n private pushService: PushService,\n private jwtService: JwtService,\n ) {}\n\n @Post('signup')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async signup(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: cleanString(dto.password),\n };\n\n try {\n const res: boolean = await this.authService.signup(cleanedDTO);\n\n if (!res) {\n handleError('Error creating user');\n }\n } catch (error: any) {\n if (error?.error_message) {\n handleError(error.error_message);\n } else {\n handleError('Error creating user');\n }\n }\n\n const user: User = await this.userService.create({\n email: cleanedDTO.email,\n });\n\n if (!user) {\n handleError('Error creating user');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @Post('login')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async login(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: dto.password.trim(),\n };\n\n const res: boolean = await this.authService.login(cleanedDTO);\n\n if (!res) {\n handleError('Error logging in');\n }\n\n const user: User = await this.userService.findOneByEmail(cleanedDTO.email);\n\n if (!user) {\n handleError('Error logging in');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @UseGuards(AuthGuard)\n @Get('self')\n @ApiResponse({\n status: 200,\n description: 'get self successful',\n type: GetUserResponseDto,\n })\n async getSelf(@Request() req): Promise<GetUserResponseDto> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('update')\n @ApiResponse({\n status: 200,\n description: 'update user successful',\n type: GetUserResponseDto,\n })\n async edit(\n @Body() dto: UpdateUserRequestDto,\n @Request() req,\n ): Promise<GetUserResponseDto> {\n try {\n const cleanDto: UpdateUserRequestDto = {\n phoneNumber: dto.phoneNumber\n ? cleanPhoneNumber(dto.phoneNumber)\n : undefined,\n fullName: dto.fullName\n ? cleanStringAndLowercase(dto.fullName)\n : undefined,\n pushToken: dto.pushToken ? cleanString(dto.pushToken) : undefined,\n };\n\n const user: User = await this.userService.update(\n req.user.userId,\n cleanDto,\n );\n\n if (user.fullName && user.phoneNumber) {\n await this.userService.update(req.user.userId, {\n onboardingStatus: OnboardingStatus.COMPLETED,\n });\n }\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('pushTest')\n @ApiResponse({\n status: 200,\n description: 'push test successful',\n })\n async pushTest(@Request() req): Promise<void> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n if (user.pushToken) {\n const messages: ExpoPushMessage[] = this.pushService.createMessages({\n body: 'Test push',\n pushTokens: [user.pushToken],\n });\n await this.pushService.sendMessages(messages);\n }\n } catch (error) {\n handleError(error);\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EServerDay } from '../enums/serverDay.enum';
|
|
2
2
|
import { EHumanDay } from '../enums/humanDay.enum';
|
|
3
|
-
import { Moment } from
|
|
3
|
+
import { Moment } from 'moment';
|
|
4
4
|
export declare const serverDayToHumanReadable: (day: EServerDay) => EHumanDay;
|
|
5
5
|
export declare const getStartOfDateString: (date: Moment) => string;
|
|
6
6
|
//# sourceMappingURL=datetime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,eAAO,MAAM,wBAAwB,QAAS,UAAU,KAAG,SAmB1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,MAEnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":";;;;AAAA,4DAAqD;AACrD,0DAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":";;;;AAAA,4DAAqD;AACrD,0DAAmD;AACnD,4DAAwC;AAEjC,MAAM,wBAAwB,GAAG,CAAC,GAAe,EAAa,EAAE;IACrE,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,OAAO;YACrB,OAAO,yBAAS,CAAC,OAAO,CAAC;QAC3B,KAAK,2BAAU,CAAC,SAAS;YACvB,OAAO,yBAAS,CAAC,SAAS,CAAC;QAC7B,KAAK,2BAAU,CAAC,QAAQ;YACtB,OAAO,yBAAS,CAAC,QAAQ,CAAC;QAC5B,KAAK,2BAAU,CAAC,MAAM;YACpB,OAAO,yBAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,2BAAU,CAAC,QAAQ;YACtB,OAAO,yBAAS,CAAC,QAAQ,CAAC;QAC5B;YACE,OAAO,yBAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAnBW,QAAA,wBAAwB,4BAmBnC;AAEK,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3D,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { EServerDay } from '../enums/serverDay.enum';\nimport { EHumanDay } from '../enums/humanDay.enum';\nimport moment, { Moment } from 'moment';\n\nexport const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {\n switch (day) {\n case EServerDay.SUNDAY:\n return EHumanDay.SUNDAY;\n case EServerDay.MONDAY:\n return EHumanDay.MONDAY;\n case EServerDay.TUESDAY:\n return EHumanDay.TUESDAY;\n case EServerDay.WEDNESDAY:\n return EHumanDay.WEDNESDAY;\n case EServerDay.THURSDAY:\n return EHumanDay.THURSDAY;\n case EServerDay.FRIDAY:\n return EHumanDay.FRIDAY;\n case EServerDay.SATURDAY:\n return EHumanDay.SATURDAY;\n default:\n return EHumanDay.SUNDAY;\n }\n};\n\nexport const getStartOfDateString = (date: Moment): string => {\n return moment(date).utc().startOf('day').toDate().toISOString();\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,kDAAwB;AACxB,kDAAwB;AACxB,mDAAyB","sourcesContent":["export * from './datetime';\nexport * from './error';\nexport * from './input';\nexport * from './string';\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HealthCheckResult, HealthCheckStatus } from '@nestjs/terminus
|
|
2
|
-
import { HealthIndicatorResult } from '@nestjs/terminus/dist/health-indicator';
|
|
1
|
+
import type { HealthCheckResult, HealthCheckStatus, HealthIndicatorResult } from '@nestjs/terminus';
|
|
3
2
|
export declare class HealthResponseDto implements HealthCheckResult {
|
|
4
3
|
status: HealthCheckStatus;
|
|
5
4
|
info?: HealthIndicatorResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.response.dto.d.ts","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.response.dto.d.ts","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,iBAAiB;IAEzD,MAAM,EAAE,iBAAiB,CAAC;IAG1B,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAG7B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAG9B,OAAO,EAAE,qBAAqB,CAAC;IAI/B,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.response.dto.js","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"health.response.dto.js","sourceRoot":"/","sources":["health/dtos/health.response.dto.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,MAAM,OAAO,iBAAiB;CAgB7B;AAdC;IADC,WAAW,EAAE;;iDACY;AAG1B;IADC,WAAW,EAAE;;+CACe;AAG7B;IADC,WAAW,EAAE;;gDACgB;AAG9B;IADC,WAAW,EAAE;;kDACiB;AAI/B;IAFC,QAAQ,EAAE;IACV,WAAW,EAAE;;sDACM","sourcesContent":["import { IsString } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\nimport type {\n HealthCheckResult,\n HealthCheckStatus,\n HealthIndicatorResult,\n} from '@nestjs/terminus';\n\nexport class HealthResponseDto implements HealthCheckResult {\n @ApiProperty()\n status: HealthCheckStatus;\n\n @ApiProperty()\n info?: HealthIndicatorResult;\n\n @ApiProperty()\n error?: HealthIndicatorResult;\n\n @ApiProperty()\n details: HealthIndicatorResult;\n\n @IsString()\n @ApiProperty()\n environment: string;\n}\n"]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { HealthCheckService,
|
|
1
|
+
import { HealthCheckService, MemoryHealthIndicator } from '@nestjs/terminus';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
3
|
import { HealthResponseDto } from './dtos/health.response.dto';
|
|
4
4
|
export declare class HealthService {
|
|
5
5
|
private readonly configService;
|
|
6
6
|
private readonly health;
|
|
7
|
-
private readonly http;
|
|
8
7
|
private readonly memory;
|
|
9
8
|
private readonly logger;
|
|
10
|
-
constructor(configService: ConfigService, health: HealthCheckService,
|
|
9
|
+
constructor(configService: ConfigService, health: HealthCheckService, memory: MemoryHealthIndicator);
|
|
11
10
|
check(): Promise<HealthResponseDto>;
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=health.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.service.d.ts","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"health.service.d.ts","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,qBACa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;gBAG9C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,qBAAqB;IAG1C,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAgB1C"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
var HealthService_1;
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
3
|
import { Injectable, Logger } from '@nestjs/common';
|
|
4
|
-
import { HealthCheckService,
|
|
4
|
+
import { HealthCheckService, MemoryHealthIndicator, } from '@nestjs/terminus';
|
|
5
5
|
import { ConfigService } from '@nestjs/config';
|
|
6
6
|
let HealthService = HealthService_1 = class HealthService {
|
|
7
|
-
constructor(configService, health,
|
|
7
|
+
constructor(configService, health, memory) {
|
|
8
8
|
this.configService = configService;
|
|
9
9
|
this.health = health;
|
|
10
|
-
this.http = http;
|
|
11
10
|
this.memory = memory;
|
|
12
11
|
this.logger = new Logger(HealthService_1.name);
|
|
13
12
|
}
|
|
14
13
|
async check() {
|
|
15
14
|
this.logger.log('check');
|
|
16
15
|
const statuses = await this.health.check([
|
|
17
|
-
async () => this.http.pingCheck('website', 'https://google.com'),
|
|
18
16
|
async () => this.memory.checkHeap('memoryHeap', 200 * 1024 * 1024),
|
|
19
17
|
async () => this.memory.checkRSS('memoryRss', 3000 * 1024 * 1024),
|
|
20
18
|
]);
|
|
@@ -26,7 +24,6 @@ HealthService = HealthService_1 = __decorate([
|
|
|
26
24
|
Injectable(),
|
|
27
25
|
__metadata("design:paramtypes", [ConfigService,
|
|
28
26
|
HealthCheckService,
|
|
29
|
-
HttpHealthIndicator,
|
|
30
27
|
MemoryHealthIndicator])
|
|
31
28
|
], HealthService);
|
|
32
29
|
export { HealthService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.service.js","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"health.service.js","sourceRoot":"/","sources":["health/health.service.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOxC,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIxB,YACmB,aAA4B,EAC5B,MAA0B,EAC1B,MAA6B;QAF7B,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAoB;QAC1B,WAAM,GAAN,MAAM,CAAuB;QAL/B,WAAM,GAAW,IAAI,MAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAM9D,CAAC;IAEJ,KAAK,CAAC,KAAK;QAET,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,QAAQ,GAAsB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1D,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;YAClE,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;SAClE,CAAC,CAAC;QAEH,MAAM,WAAW,GAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,UAAU,CAAC,CAAC;QAEvE,uBACE,WAAW,IACR,QAAQ,EACX;IACJ,CAAC;CACF,CAAA;AA1BY,aAAa;IADzB,UAAU,EAAE;qCAMuB,aAAa;QACpB,kBAAkB;QAClB,qBAAqB;GAPrC,aAAa,CA0BzB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport {\n HealthCheckResult,\n HealthCheckService,\n MemoryHealthIndicator,\n} from '@nestjs/terminus';\nimport { ConfigService } from '@nestjs/config';\n\nimport { HealthResponseDto } from './dtos/health.response.dto';\n\n// this decorator indicates to nest that this class can be provided to a module\n// we want to handle logic in services to keep our resolvers and controllers clean\n@Injectable()\nexport class HealthService {\n // grab the global logger instance\n private readonly logger: Logger = new Logger(HealthService.name);\n\n constructor(\n private readonly configService: ConfigService,\n private readonly health: HealthCheckService,\n private readonly memory: MemoryHealthIndicator,\n ) {}\n\n async check(): Promise<HealthResponseDto> {\n // this logger has several logging levels\n this.logger.log('check');\n\n const statuses: HealthCheckResult = await this.health.check([\n async () => this.memory.checkHeap('memoryHeap', 200 * 1024 * 1024),\n async () => this.memory.checkRSS('memoryRss', 3000 * 1024 * 1024),\n ]);\n\n const environment: string = this.configService.get<string>('NODE_ENV');\n\n return {\n environment,\n ...statuses,\n };\n }\n}\n"]}
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC","sourcesContent":["export * from './auth';\nexport * from './enums';\nexport * from './guard';\nexport * from './health';\nexport * from './middleware';\nexport * from './prisma';\nexport * from './push';\nexport * from './search';\nexport * from './services';\nexport * from './types';\nexport * from './user';\nexport * from './utils';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["services/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './instrument-sentry';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAetB,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.d.ts","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,YAetB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAE7B,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,YAAY,EAAE;YAEZ,wBAAwB,EAAE;SAC3B;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,
|
|
1
|
+
{"version":3,"file":"instrument-sentry.js","sourceRoot":"/","sources":["services/instrument-sentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAE7B,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC3B,YAAY,EAAE;YAEZ,wBAAwB,EAAE;SAC3B;QAGD,gBAAgB,EAAE,GAAG;QAGrB,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { nodeProfilingIntegration } from '@sentry/profiling-node';\n\nexport const initSentry = () => {\n // Ensure to call this before requiring any other modules!\n Sentry.init({\n dsn: process.env.SENTRY_DSN,\n integrations: [\n // Add our Profiling integration\n nodeProfilingIntegration(),\n ],\n // Add Tracing by setting tracesSampleRate\n // We recommend adjusting this value in production\n tracesSampleRate: 1.0,\n // Set sampling rate for profiling\n // This is relative to tracesSampleRate\n profilesSampleRate: 1.0,\n });\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["user/dtos/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './get-user.response.dto';\nexport * from './register.request.dto';\nexport * from './register.response.dto';\nexport * from './update-user.request.dto';\n
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["user/dtos/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './get-user.response.dto';\nexport * from './register.request.dto';\nexport * from './register.response.dto';\nexport * from './update-user.request.dto';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.d.ts","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"user.controller.d.ts","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASnD,qBAEa,cAAc;IAEvB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,UAAU;gBAHV,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU;IAS1B,MAAM,CAAS,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2CrE,KAAK,CAAS,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkCpE,OAAO,CAAY,GAAG,KAAA,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAmBpD,IAAI,CACA,GAAG,EAAE,oBAAoB,EACtB,GAAG,KAAA,GACb,OAAO,CAAC,kBAAkB,CAAC;IAmCxB,QAAQ,CAAY,GAAG,KAAA,GAAG,OAAO,CAAC,IAAI,CAAC;CAiB9C"}
|
|
@@ -10,8 +10,8 @@ import { UpdateUserRequestDto } from './dtos/update-user.request.dto';
|
|
|
10
10
|
import { RegisterResponseDto } from './dtos/register.response.dto';
|
|
11
11
|
import { RegisterRequestDto } from './dtos/register.request.dto';
|
|
12
12
|
import { PushService } from '../push/push.service';
|
|
13
|
-
import { cleanPhoneNumber, cleanString, cleanStringAndLowercase, handleError } from
|
|
14
|
-
import { AuthGuard } from
|
|
13
|
+
import { cleanPhoneNumber, cleanString, cleanStringAndLowercase, handleError, } from '../utils';
|
|
14
|
+
import { AuthGuard } from '../guard';
|
|
15
15
|
let UserController = class UserController {
|
|
16
16
|
constructor(userService, authService, pushService, jwtService) {
|
|
17
17
|
this.userService = userService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.controller.js","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,GAAG,EACH,IAAI,EACJ,OAAO,EACP,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAQ,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,k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rC,IAAI,EAAE,kBAAkB;KACzB,CAAC;IAEC,WAAA,IAAI,EAAE,CAAA;IACN,WAAA,OAAO,EAAE,CAAA;;qCADG,oBAAoB;;0CA6BlC;AAQK;IANL,SAAS,CAAC,SAAS,CAAC;IACpB,IAAI,CAAC,UAAU,CAAC;IAChB,WAAW,CAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,sBAAsB;KACpC,CAAC;IACc,WAAA,OAAO,EAAE,CAAA;;;;8CAgBxB;AApKU,cAAc;IAF1B,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,CAAC,MAAM,CAAC;qCAGM,WAAW;QACX,WAAW;QACX,WAAW;QACZ,UAAU;GALrB,cAAc,CAqK1B","sourcesContent":["import {\n Body,\n Controller,\n Get,\n Post,\n Request,\n UseGuards,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { ApiResponse, ApiTags } from '@nestjs/swagger';\nimport { OnboardingStatus, User } from '@prisma/client';\nimport { ExpoPushMessage } from 'expo-server-sdk';\n\nimport { AuthService } from '../auth/auth.service';\nimport { UserService } from './user.service';\nimport { GetUserResponseDto } from './dtos/get-user.response.dto';\nimport { UpdateUserRequestDto } from './dtos/update-user.request.dto';\nimport { RegisterResponseDto } from './dtos/register.response.dto';\nimport { RegisterRequestDto } from './dtos/register.request.dto';\nimport { PushService } from '../push/push.service';\nimport {cleanPhoneNumber, cleanString, cleanStringAndLowercase, handleError} from \"../utils\";\nimport {AuthGuard} from \"../guard\";\n\n@ApiTags('User')\n@Controller('user')\nexport class UserController {\n constructor(\n private userService: UserService,\n private authService: AuthService,\n private pushService: PushService,\n private jwtService: JwtService,\n ) {}\n\n @Post('signup')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async signup(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: cleanString(dto.password),\n };\n\n try {\n const res: boolean = await this.authService.signup(cleanedDTO);\n\n if (!res) {\n handleError('Error creating user');\n }\n } catch (error: any) {\n if (error?.error_message) {\n handleError(error.error_message);\n } else {\n handleError('Error creating user');\n }\n }\n\n const user: User = await this.userService.create({\n email: cleanedDTO.email,\n });\n\n if (!user) {\n handleError('Error creating user');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @Post('login')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async login(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: dto.password.trim(),\n };\n\n const res: boolean = await this.authService.login(cleanedDTO);\n\n if (!res) {\n handleError('Error logging in');\n }\n\n const user: User = await this.userService.findOneByEmail(cleanedDTO.email);\n\n if (!user) {\n handleError('Error logging in');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @UseGuards(AuthGuard)\n @Get('self')\n @ApiResponse({\n status: 200,\n description: 'get self successful',\n type: GetUserResponseDto,\n })\n async getSelf(@Request() req): Promise<GetUserResponseDto> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('update')\n @ApiResponse({\n status: 200,\n description: 'update user successful',\n type: GetUserResponseDto,\n })\n async edit(\n @Body() dto: UpdateUserRequestDto,\n @Request() req,\n ): Promise<GetUserResponseDto> {\n try {\n const cleanDto: UpdateUserRequestDto = {\n phoneNumber: dto.phoneNumber\n ? cleanPhoneNumber(dto.phoneNumber)\n : undefined,\n fullName: dto.fullName\n ? cleanStringAndLowercase(dto.fullName)\n : undefined,\n pushToken: dto.pushToken ? cleanString(dto.pushToken) : undefined,\n };\n\n const user: User = await this.userService.update(\n req.user.userId,\n cleanDto,\n );\n\n if (user.fullName && user.phoneNumber) {\n await this.userService.update(req.user.userId, {\n onboardingStatus: OnboardingStatus.COMPLETED,\n });\n }\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('pushTest')\n @ApiResponse({\n status: 200,\n description: 'push test successful',\n })\n async pushTest(@Request() req): Promise<void> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n if (user.pushToken) {\n const messages: ExpoPushMessage[] = this.pushService.createMessages({\n body: 'Test push',\n pushTokens: [user.pushToken],\n });\n await this.pushService.sendMessages(messages);\n }\n } catch (error) {\n handleError(error);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"user.controller.js","sourceRoot":"/","sources":["user/user.controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,GAAG,EACH,IAAI,EACJ,OAAO,EACP,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAQ,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,WAAW,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KU,cAAc;IAF1B,OAAO,CAAC,MAAM,CAAC;IACf,UAAU,CAAC,MAAM,CAAC;qCAGM,WAAW;QACX,WAAW;QACX,WAAW;QACZ,UAAU;GALrB,cAAc,CAqK1B","sourcesContent":["import {\n Body,\n Controller,\n Get,\n Post,\n Request,\n UseGuards,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { ApiResponse, ApiTags } from '@nestjs/swagger';\nimport { OnboardingStatus, User } from '@prisma/client';\nimport { ExpoPushMessage } from 'expo-server-sdk';\n\nimport { AuthService } from '../auth/auth.service';\nimport { UserService } from './user.service';\nimport { GetUserResponseDto } from './dtos/get-user.response.dto';\nimport { UpdateUserRequestDto } from './dtos/update-user.request.dto';\nimport { RegisterResponseDto } from './dtos/register.response.dto';\nimport { RegisterRequestDto } from './dtos/register.request.dto';\nimport { PushService } from '../push/push.service';\nimport {\n cleanPhoneNumber,\n cleanString,\n cleanStringAndLowercase,\n handleError,\n} from '../utils';\nimport { AuthGuard } from '../guard';\n\n@ApiTags('User')\n@Controller('user')\nexport class UserController {\n constructor(\n private userService: UserService,\n private authService: AuthService,\n private pushService: PushService,\n private jwtService: JwtService,\n ) {}\n\n @Post('signup')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async signup(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: cleanString(dto.password),\n };\n\n try {\n const res: boolean = await this.authService.signup(cleanedDTO);\n\n if (!res) {\n handleError('Error creating user');\n }\n } catch (error: any) {\n if (error?.error_message) {\n handleError(error.error_message);\n } else {\n handleError('Error creating user');\n }\n }\n\n const user: User = await this.userService.create({\n email: cleanedDTO.email,\n });\n\n if (!user) {\n handleError('Error creating user');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @Post('login')\n @ApiResponse({\n status: 200,\n description: 'loginOrCreate successful',\n type: RegisterResponseDto,\n })\n async login(@Body() dto: RegisterRequestDto): Promise<RegisterResponseDto> {\n const cleanedDTO: RegisterRequestDto = {\n email: cleanStringAndLowercase(dto.email),\n password: dto.password.trim(),\n };\n\n const res: boolean = await this.authService.login(cleanedDTO);\n\n if (!res) {\n handleError('Error logging in');\n }\n\n const user: User = await this.userService.findOneByEmail(cleanedDTO.email);\n\n if (!user) {\n handleError('Error logging in');\n }\n\n const payload = { userId: user.id };\n const token: string = await this.jwtService.signAsync(payload);\n\n return {\n ...user,\n token,\n };\n }\n\n @UseGuards(AuthGuard)\n @Get('self')\n @ApiResponse({\n status: 200,\n description: 'get self successful',\n type: GetUserResponseDto,\n })\n async getSelf(@Request() req): Promise<GetUserResponseDto> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('update')\n @ApiResponse({\n status: 200,\n description: 'update user successful',\n type: GetUserResponseDto,\n })\n async edit(\n @Body() dto: UpdateUserRequestDto,\n @Request() req,\n ): Promise<GetUserResponseDto> {\n try {\n const cleanDto: UpdateUserRequestDto = {\n phoneNumber: dto.phoneNumber\n ? cleanPhoneNumber(dto.phoneNumber)\n : undefined,\n fullName: dto.fullName\n ? cleanStringAndLowercase(dto.fullName)\n : undefined,\n pushToken: dto.pushToken ? cleanString(dto.pushToken) : undefined,\n };\n\n const user: User = await this.userService.update(\n req.user.userId,\n cleanDto,\n );\n\n if (user.fullName && user.phoneNumber) {\n await this.userService.update(req.user.userId, {\n onboardingStatus: OnboardingStatus.COMPLETED,\n });\n }\n\n return user as GetUserResponseDto;\n } catch (error) {\n handleError(error);\n }\n }\n\n @UseGuards(AuthGuard)\n @Post('pushTest')\n @ApiResponse({\n status: 200,\n description: 'push test successful',\n })\n async pushTest(@Request() req): Promise<void> {\n try {\n const user: User = await this.userService.findOneByUserId(\n req.user.userId,\n );\n\n if (user.pushToken) {\n const messages: ExpoPushMessage[] = this.pushService.createMessages({\n body: 'Test push',\n pushTokens: [user.pushToken],\n });\n await this.pushService.sendMessages(messages);\n }\n } catch (error) {\n handleError(error);\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EServerDay } from '../enums/serverDay.enum';
|
|
2
2
|
import { EHumanDay } from '../enums/humanDay.enum';
|
|
3
|
-
import { Moment } from
|
|
3
|
+
import { Moment } from 'moment';
|
|
4
4
|
export declare const serverDayToHumanReadable: (day: EServerDay) => EHumanDay;
|
|
5
5
|
export declare const getStartOfDateString: (date: Moment) => string;
|
|
6
6
|
//# sourceMappingURL=datetime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,eAAO,MAAM,wBAAwB,QAAS,UAAU,KAAG,SAmB1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,KAAG,MAEnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"datetime.js","sourceRoot":"/","sources":["utils/datetime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,MAAkB,MAAM,QAAQ,CAAC;AAExC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAe,EAAa,EAAE;IACrE,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,OAAO;YACrB,OAAO,SAAS,CAAC,OAAO,CAAC;QAC3B,KAAK,UAAU,CAAC,SAAS;YACvB,OAAO,SAAS,CAAC,SAAS,CAAC;QAC7B,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,SAAS,CAAC,QAAQ,CAAC;QAC5B,KAAK,UAAU,CAAC,MAAM;YACpB,OAAO,SAAS,CAAC,MAAM,CAAC;QAC1B,KAAK,UAAU,CAAC,QAAQ;YACtB,OAAO,SAAS,CAAC,QAAQ,CAAC;QAC5B;YACE,OAAO,SAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC,CAAC","sourcesContent":["import { EServerDay } from '../enums/serverDay.enum';\nimport { EHumanDay } from '../enums/humanDay.enum';\nimport moment, { Moment } from 'moment';\n\nexport const serverDayToHumanReadable = (day: EServerDay): EHumanDay => {\n switch (day) {\n case EServerDay.SUNDAY:\n return EHumanDay.SUNDAY;\n case EServerDay.MONDAY:\n return EHumanDay.MONDAY;\n case EServerDay.TUESDAY:\n return EHumanDay.TUESDAY;\n case EServerDay.WEDNESDAY:\n return EHumanDay.WEDNESDAY;\n case EServerDay.THURSDAY:\n return EHumanDay.THURSDAY;\n case EServerDay.FRIDAY:\n return EHumanDay.FRIDAY;\n case EServerDay.SATURDAY:\n return EHumanDay.SATURDAY;\n default:\n return EHumanDay.SUNDAY;\n }\n};\n\nexport const getStartOfDateString = (date: Moment): string => {\n return moment(date).utc().startOf('day').toDate().toISOString();\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC","sourcesContent":["export * from './datetime';\nexport * from './error';\nexport * from './input';\nexport * from './string';\n"]}
|