📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Starting to implement a subscriber update feature
Yevhenii Kulisidia5d6f8b7de26
diff --git a/src/project/dto/index.ts b/src/project/dto/index.tsindex 7f62ac689..a94045cbb 100644--- a/src/project/dto/index.ts+++ b/src/project/dto/index.ts@@ -1,3 +1,4 @@export * from './add-subscriber.dto'export * from './get-subscribers.dto'+export * from './update-subscriber.dto'export * from './remove-subscriber.dto'diff --git a/src/project/dto/update-subscriber.dto.ts b/src/project/dto/update-subscriber.dto.tsnew file mode 100644index 000000000..973cfd46e--- /dev/null+++ b/src/project/dto/update-subscriber.dto.ts@@ -0,0 +1,15 @@+import { PartialType } from '@nestjs/swagger'+import { Matches, IsUUID } from 'class-validator'+import { AddSubscriberBodyDto } from './add-subscriber.dto'++export class UpdateSubscriberParamsDto {+ @Matches(/^(?!.*--)[a-zA-Z0-9-]{12}$/)+ readonly projectId: string++ @IsUUID('4')+ readonly subscriberId: string+}++export class UpdateSubscriberBodyDto extends PartialType(+ AddSubscriberBodyDto,+) {}diff --git a/src/project/project.controller.ts b/src/project/project.controller.tsindex b03826f7a..dfdfebd18 100644--- a/src/project/project.controller.ts+++ b/src/project/project.controller.ts@@ -14,6 +14,7 @@ import {ForbiddenException,Headers,NotImplementedException,+ Patch,} from '@nestjs/common'import { ApiTags, ApiQuery, ApiResponse } from '@nestjs/swagger'import * as _isEmpty from 'lodash/isEmpty'@@ -56,10 +57,12 @@ import {import { JwtAccessTokenGuard } from 'src/auth/guards'import { Auth, Public } from 'src/auth/decorators'import {- AddSubscriberBodyDto,AddSubscriberParamsDto,+ AddSubscriberBodyDto,GetSubscribersParamsDto,GetSubscribersQueriesDto,+ UpdateSubscriberParamsDto,+ UpdateSubscriberBodyDto,RemoveSubscriberParamsDto,} from './dto'@@ -810,6 +813,14 @@ export class ProjectController {// TODO: Implement}+ @Patch(':projectId/subscribers/:subscriberId')+ async updateSubscriber(+ @Param() params: UpdateSubscriberParamsDto,+ @Body() body: UpdateSubscriberBodyDto,+ ): Promise<void> {+ // TODO: Implement+ }+@Delete(':projectId/subscribers/:subscriberId')async removeSubscriber(@Param() params: RemoveSubscriberParamsDto,