Skip to content

📈 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!

Added DTOs for routes

Yevhenii Kulisidi95fabd05c8be
diff --git a/src/project/dto/add-subscriber.dto.ts b/src/project/dto/add-subscriber.dto.ts
new file mode 100644
index 000000000..c52c81d4b
--- /dev/null
+++ b/src/project/dto/add-subscriber.dto.ts
@@ -0,0 +1,7 @@
+export class AddSubscriberParamsDto {
+ readonly projectId: string
+}
+
+export class AddSubscriberBodyDto {
+ readonly email: string
+}
diff --git a/src/project/dto/get-subscribers.dto.ts b/src/project/dto/get-subscribers.dto.ts
new file mode 100644
index 000000000..07ce80ba9
--- /dev/null
+++ b/src/project/dto/get-subscribers.dto.ts
@@ -0,0 +1,8 @@
+export class GetSubscribersParamsDto {
+ readonly projectId: string
+}
+
+export class GetSubscribersQueriesDto {
+ readonly offset?: string
+ readonly limit?: string
+}
diff --git a/src/project/dto/index.ts b/src/project/dto/index.ts
new file mode 100644
index 000000000..7f62ac689
--- /dev/null
+++ b/src/project/dto/index.ts
@@ -0,0 +1,3 @@
+export * from './add-subscriber.dto'
+export * from './get-subscribers.dto'
+export * from './remove-subscriber.dto'
diff --git a/src/project/dto/remove-subscriber.dto.ts b/src/project/dto/remove-subscriber.dto.ts
new file mode 100644
index 000000000..d2bc8898f
--- /dev/null
+++ b/src/project/dto/remove-subscriber.dto.ts
@@ -0,0 +1,4 @@
+export class RemoveSubscriberParamsDto {
+ readonly projectId: string
+ readonly subscriberId: string
+}
diff --git a/src/project/project.controller.ts b/src/project/project.controller.ts
index 7b518c906..b03826f7a 100644
--- a/src/project/project.controller.ts
+++ b/src/project/project.controller.ts
@@ -55,6 +55,13 @@ import {
} from '../common/utils'
import { JwtAccessTokenGuard } from 'src/auth/guards'
import { Auth, Public } from 'src/auth/decorators'
+import {
+ AddSubscriberBodyDto,
+ AddSubscriberParamsDto,
+ GetSubscribersParamsDto,
+ GetSubscribersQueriesDto,
+ RemoveSubscriberParamsDto,
+} from './dto'
const PROJECTS_MAXIMUM = ACCOUNT_PLANS[PlanCode.free].maxProjects
@@ -788,17 +795,25 @@ export class ProjectController {
}
@Post(':projectId/subscribers')
- async addSubscriber(): Promise<void> {
+ async addSubscriber(
+ @Param() params: AddSubscriberParamsDto,
+ @Body() body: AddSubscriberBodyDto,
+ ): Promise<void> {
// TODO: Implement
}
@Get(':projectId/subscribers')
- async getSubscribers(): Promise<void> {
+ async getSubscribers(
+ @Param() params: GetSubscribersParamsDto,
+ @Query() queries: GetSubscribersQueriesDto,
+ ): Promise<void> {
// TODO: Implement
}
@Delete(':projectId/subscribers/:subscriberId')
- async removeSubscriber(): Promise<void> {
+ async removeSubscriber(
+ @Param() params: RemoveSubscriberParamsDto,
+ ): Promise<void> {
// TODO: Implement
}
}