Skip to content

Almin: UseCase#shouldExecute #292

@azu

Description

@azu

This is a proposal for UseCase#shouldExecute life-cycle method.

What it UseCase#shouldExecute?

Currently, the user can't prevent to execute of UseCase by declaratory.
Also, almin-logger does log the execute, but this usecase is not executed actually,

class MyUseCase extends UseCase {
    execute(args){
        if(condition){
             return false; // if this usecase should not execute
        }
        // do something
    }
}

This proposal allow to write following.
Thun, the user canprevent to execute of UseCase by declaratory.
almin-logger does not log the execution.

class MyUseCase extends UseCase {
    shouldExecute(args): boolean {
         return false; // if this usecase should not execute
    }
    execute(args){
        // do something
    }
}

Pros

Cons

  • Adding new life-cycle methods

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions