/** * Profile use cases. Thin orchestration over ports; ownership/role checks * happen in the API layer before these run. */ import type { ProfileRepository } from '../domain/ports.js'; import type { Profile, ProfilePatch } from '../domain/profile.js'; export class GetProfile { constructor(private readonly profiles: ProfileRepository) {} async execute(userId: string): Promise { return this.profiles.findByUserId(userId); } } export class UpdateProfile { constructor(private readonly profiles: ProfileRepository) {} async execute(userId: string, patch: ProfilePatch): Promise { return this.profiles.upsert(userId, patch); } } export class ListProfiles { constructor(private readonly profiles: ProfileRepository) {} async execute(): Promise { return this.profiles.list(); } }