import { PgUser } from '@/infra/repos/postgres/entities' ; import { PgRepository } from '@/infra/repos/postgres/repository' ; import { LoadUserProfile , SaveUserPicture } from '@/domain/contracts/repos' ; export class PgUserProfileRepository extends PgRepository implements SaveUserPicture , LoadUserProfile { async savePicture ( { id , pictureUrl , initials } ) { const pgUserRepo = this . getRepository ( PgUser ) ; await pgUserRepo . update ( { id : parseInt ( id ) } , { pictureUrl , initials } ) ; } async load ( { id } ) { const pgUserRepo = this . getRepository ( PgUser ) ; const pgUser = await pgUserRepo . findOne ( { id : parseInt ( id ) } ) ; if ( pgUser !== undefined ) return { name : pgUser . name ?? undefined } ; } }