-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add user-based organization retrieval methods, update DTOs for …
…organization creation and updates, Add Swagger decorators
- Loading branch information
Showing
8 changed files
with
136 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
src/routes/organizations/entities/create-organization.dto.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import { Organization } from '@/datasources/organizations/entities/organizations.entity.db'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { z } from 'zod'; | ||
|
||
export class CreateOrganizationDto { | ||
@ApiProperty() | ||
name!: Organization['name']; | ||
export const CreateOrganizationSchema = z.object({ | ||
name: z.string(), | ||
}); | ||
|
||
export class CreateOrganizationDto | ||
implements z.infer<typeof CreateOrganizationSchema> | ||
{ | ||
@ApiProperty({ type: String }) | ||
public readonly name!: Organization['name']; | ||
} |
9 changes: 7 additions & 2 deletions
9
src/routes/organizations/entities/create-organizations.dto.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import { Organization } from '@/datasources/organizations/entities/organizations.entity.db'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { number } from 'zod'; | ||
|
||
export class CreateOrganizationResponse { | ||
@ApiProperty() | ||
name!: string; | ||
@ApiProperty({ type: String }) | ||
public readonly name!: Organization['name']; | ||
|
||
@ApiProperty({ type: number }) | ||
public readonly id!: Organization['id']; | ||
} |
15 changes: 9 additions & 6 deletions
15
src/routes/organizations/entities/update-organization.dto.entity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { Organization } from '@/datasources/organizations/entities/organizations.entity.db'; | ||
import { OrganizationStatus } from '@/domain/organizations/entities/organization.entity'; | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
|
||
export class UpdateOrganizationDto { | ||
@ApiPropertyOptional() | ||
public name?: string; | ||
@ApiPropertyOptional({ type: String }) | ||
public readonly name?: Organization['name']; | ||
|
||
@ApiPropertyOptional() | ||
public status?: OrganizationStatus; | ||
@ApiPropertyOptional({ | ||
enum: OrganizationStatus, | ||
}) | ||
public readonly status?: OrganizationStatus; | ||
} | ||
|
||
export class UpdateOrganizationResponse { | ||
@ApiProperty() | ||
public id!: number; | ||
@ApiProperty({ type: Number }) | ||
public readonly id!: Organization['id']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters