import { UseCase } from "almin" ; import { repositoryContainer } from "../../infra/repository/RepositoryContainer" ; import { AppRepository } from "../../infra/repository/AppRepository" ; import { InoreaderAuthorityIdentifier } from "../../domain/App/Authority/InoreaderAuthority" ; export const createUpdateAuthorizeUseCase = ( ) => { return new UpdateAuthorizeUseCase ( repositoryContainer . get ( ) ) ; } ; export class UpdateAuthorizeUseCase extends UseCase { constructor ( private repo ) { super ( ) ; } execute ( { clientId , clientSecret } ) { const app = this . repo . appRepository . get ( ) ; const newAuthority = app . user . authority . update ( { id : new InoreaderAuthorityIdentifier ( clientId ) , clientId , clientSecret } ) ; app . user . updateAuthority ( newAuthority ) ; this . repo . appRepository . save ( app ) ; } }