services refactor
This commit is contained in:
39
apps/website/lib/presenters/AvatarPresenter.ts
Normal file
39
apps/website/lib/presenters/AvatarPresenter.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type {
|
||||
GetAvatarOutputDto,
|
||||
RequestAvatarGenerationOutputDto,
|
||||
UpdateAvatarOutputDto
|
||||
} from '../dtos';
|
||||
import type {
|
||||
AvatarViewModel,
|
||||
RequestAvatarGenerationViewModel,
|
||||
UpdateAvatarViewModel
|
||||
} from '../view-models';
|
||||
|
||||
/**
|
||||
* Avatar Presenter
|
||||
* Transforms avatar DTOs to ViewModels
|
||||
*/
|
||||
export class AvatarPresenter {
|
||||
presentAvatar(dto: GetAvatarOutputDto): AvatarViewModel {
|
||||
return {
|
||||
driverId: dto.driverId,
|
||||
avatarUrl: dto.avatarUrl,
|
||||
hasAvatar: dto.hasAvatar,
|
||||
};
|
||||
}
|
||||
|
||||
presentRequestGeneration(dto: RequestAvatarGenerationOutputDto): RequestAvatarGenerationViewModel {
|
||||
return {
|
||||
success: dto.success,
|
||||
avatarUrl: dto.avatarUrl,
|
||||
error: dto.error,
|
||||
};
|
||||
}
|
||||
|
||||
presentUpdate(dto: UpdateAvatarOutputDto): UpdateAvatarViewModel {
|
||||
return {
|
||||
success: dto.success,
|
||||
error: dto.error,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user