Skip to content

Commit

Permalink
dtos and types added
Browse files Browse the repository at this point in the history
  • Loading branch information
AmmarAlkhooly98 committed Jul 26, 2023
1 parent 913926f commit a6115de
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"workspaces": [
"client",
"server"
"server",
"shared"
],
"scripts": {
"docker:compose": "docker-compose up -d",
Expand Down
14 changes: 14 additions & 0 deletions server/src/polls/dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,17 @@ export class JoinPollDto {
@Length(1, 18)
name: string;
}

export class RejoinPollDto {
@IsString()
@Length(6, 6)
pollID: string;

@IsString()
@Length(1, 18)
name: string;

@IsString()
@Length(6, 6)
userID: string;
}
43 changes: 43 additions & 0 deletions server/src/polls/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Request } from '@nestjs/common';
import { type } from 'os';

// service types
export type CreatePollFields = {
topic: string;
votesPerVoter: number;
name: string;
};

export type JoinPollFields = {
pollID: string;
name: string;
};

export type RejoinPollFields = {
pollID: string;
userID: string;
name: string;
};

// repository types
export type CreatePollData = {
pollID: string;
topic: string;
votesPerVoter: number;
userID: string;
};

export type AddParticipantData = {
pollID: string;
userID: string;
name: string;
};

// Guard types
type AuthPayload = {
userID: string;
pollID: string;
name: string;
};

export type RequestWithAuth = Request & AuthPayload;

0 comments on commit a6115de

Please sign in to comment.