import { EntrypointNotFoundError } from "../common/errors" ; import Usecase from "../common/Usecase" ; import { Operation } from "../entities/OperationLog" ; export default class DeleteEntrypoint extends Usecase { async exec ( id ) { const toBeDeletedEntrypoint = await this . storages . entrypoints . findOne ( id ) ; if ( ! toBeDeletedEntrypoint ) { throw new EntrypointNotFoundError ( id , "id" ) ; } await this . authorizer . ensureCanDeleteEntrypoint ( toBeDeletedEntrypoint . urlMatcher ) ; await this . storages . entrypoints . deleteOne ( id ) ; await this . operationLogger . logOperation ( Operation . DeleteEntrypoint , { deletedEntrypoint : toBeDeletedEntrypoint , } ) ; } }