Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/event validation #19

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion apps/backend/src/event/dto/create-event.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { OmitType } from '@nestjs/swagger';

import { Event } from '../entities/event.entity';

export class CreateEventDto extends OmitType(Event, ['id', 'category', 'ownerGroupId', 'ownerUserId']) {}
export class CreateEventDto extends OmitType(Event, ['ownerGroupId', 'ownerUserId']) {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit only id, because that's the only information the database comes up with alone. The owner we should specify.

8 changes: 2 additions & 6 deletions apps/backend/src/event/entities/event.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ export class Category {
id: number;

@IsString()
@IsNotEmpty()
name: string;
balintking marked this conversation as resolved.
Show resolved Hide resolved

@IsString()
@IsOptional()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IsOptional() should stay as well, sorry if I wasn't clear

color: string;
color?: string;

@IsString()
@IsOptional()
description: string;
}
export class Event {
@IsInt()
@IsOptional()
id: number;

@IsString()
Expand Down Expand Up @@ -58,11 +57,8 @@ export class Event {
status: Status;

@IsInt()
@IsOptional()
categoryId: number;

category: Category;

@IsInt()
ownerUserId: number;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional


Expand Down