because I got bored of customising my CV for every job
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(dto): improve organization service with proper DTOs

- Create CreateOrganizationDto and UpdateOrganizationDto interfaces
- Replace generic object types with proper DTO types in OrganizationService
- Improve type safety for organization create and update operations
- Maintain consistency with other service patterns

+19 -9
+9
apps/server/src/modules/organization/organization.dto.ts
··· 1 + export interface CreateOrganizationDto { 2 + name: string; 3 + description?: string; 4 + } 5 + 6 + export interface UpdateOrganizationDto { 7 + name?: string; 8 + description?: string; 9 + }
+10 -9
apps/server/src/modules/organization/organization.service.ts
··· 1 1 import { Injectable, Logger } from "@nestjs/common"; 2 2 import { PrismaService } from "../database/prisma.service"; 3 + import type { CreateOrganizationDto, UpdateOrganizationDto } from "./organization.dto"; 3 4 import { Organization } from "./organization.entity"; 4 5 5 6 @Injectable() ··· 49 50 })); 50 51 } 51 52 52 - async create(data: { name: string; description?: string }): Promise<Organization> { 53 - this.logger.log(`Creating organization: ${data.name}`); 53 + async create(createOrganizationDto: CreateOrganizationDto): Promise<Organization> { 54 + this.logger.log(`Creating organization: ${createOrganizationDto.name}`); 54 55 55 56 const organization = await this.prisma.organization.create({ 56 57 data: { 57 - name: data.name, 58 - description: data.description ?? null, 58 + name: createOrganizationDto.name, 59 + description: createOrganizationDto.description ?? null, 59 60 }, 60 61 }); 61 62 ··· 68 69 }); 69 70 } 70 71 71 - async update(id: string, data: { name?: string; description?: string }): Promise<Organization> { 72 + async update(id: string, updateOrganizationDto: UpdateOrganizationDto): Promise<Organization> { 72 73 this.logger.log(`Updating organization: ${id}`); 73 74 74 75 const updateData: Partial<{ 75 76 name: string; 76 77 description: string | null; 77 78 }> = {}; 78 - if (data.name !== undefined) { 79 - updateData["name"] = data.name; 79 + if (updateOrganizationDto.name !== undefined) { 80 + updateData["name"] = updateOrganizationDto.name; 80 81 } 81 - if (data.description !== undefined) { 82 - updateData["description"] = data.description ?? null; 82 + if (updateOrganizationDto.description !== undefined) { 83 + updateData["description"] = updateOrganizationDto.description ?? null; 83 84 } 84 85 85 86 const organization = await this.prisma.organization.update({