1. Statement run

The Statement Run can be seen as the grouping of information with which you intend to generate a report.

The statement can be generated according to the follow filters:

  • Artist

  • DSP

  • Periods

  • Salesfiles

The report will contain the following information:

Pending….

1.1. General flow

        sequenceDiagram
    actor User
    participant FrontEnd
    participant OAS
    participant Glider
    participant S3
    participant MongoDB


    User ->> FrontEnd : Create statement run

    activate FrontEnd
    activate OAS

    FrontEnd ->> OAS : Create statement
    Note over FrontEnd, OAS: /api/statement_run/
    OAS -->> FrontEnd: Return statement id

    rect rgb(191, 223, 255)
    User ->> FrontEnd : Upload currencies
    Note right of OAS: /api/statement_run/{id}/currencies/
    FrontEnd ->> OAS: Send currencies
    OAS -->> OAS: Add currency exceptions to salesfile information
    OAS -->> FrontEnd: Return status ok
    end

    rect rgb(245, 223, 255)
    User ->> FrontEnd : Upload currency excetions
    Note right of OAS: /api/statement_run/{id}/currencies_exception/
    FrontEnd ->> OAS: Send currencies
    OAS -->> OAS: Add currency exceptions to salesfile information
    OAS -->> FrontEnd: Return status ok
    end

    User ->> FrontEnd: Upload file(s)
    loop ProcessFile
        FrontEnd ->> OAS: Create file
        Note over FrontEnd, OAS: /api/files/salesfiles/
        OAS -->> OAS: Create file with status INITIALIZED
        OAS -->> FrontEnd: Response status ok

        FrontEnd ->> OAS: Send id file
        OAS -->> OAS : Relate file with statement run
        Note over FrontEnd, OAS: /api/statement_run/{statement_id}/add-salesfile/ <br> file_id how parameter
        OAS -->> FrontEnd: Return status OK
        Note over FrontEnd,OAS: In this moment the files is asociated <br> with statement Run

        FrontEnd ->> OAS: Request presigned URL
        OAS ->> S3: Generate presigned URL
        S3 -->> OAS: Return presigned URL
        OAS -->> FrontEnd: Resonse presigned url
        deactivate OAS

        FrontEnd ->> S3: Send File
        S3 -->> FrontEnd: Status Ok

        activate OAS
        Note over FrontEnd, OAS: In this step start processing
        FrontEnd ->> OAS: Start proces cleaning
        OAS -->> OAS: update status file to UPlOADED

        activate MongoDB
        OAS ->> MongoDB: Save initial information
        MongoDB -->> OAS: Return response OK
        deactivate MongoDB

        OAS --> OAS: update status file CLEANING
        activate Glider
        OAS ->> Glider: Activate Cleaning Module
        Glider -->> Glider: Module Clieaning
        Glider -->> OAS: Call webhook with success response
        Note right of OAS: process continue if call to weebhook is OK
        deactivate Glider

        OAS -->> OAS: Change status file to CLEANED

        activate Glider
        OAS ->> Glider: Activate IMPORTER MODULE
        Glider -->> Glider: Process information

        activate MongoDB
        Glider ->> MongoDB: Save snapshot and sales
        MongoDB -->> Glider: Return response
        deactivate MongoDB

        Glider -->> OAS: Call webhook with success response

        activate MongoDB
        OAS ->> MongoDB: Retrieve Snapshots generated
        MongoDB -->> OAS: Response Data
        deactivate MongoDB

        OAS -->> OAS: Update status to PROCESSED
    end
    deactivate Glider
    deactivate OAS

    activate User
    activate OAS
    User ->> FrontEnd: Downloda report
    Note over User, FrontEnd: Only if status is PROCESSED
    FrontEnd ->> OAS: Request report
    OAS -->> FrontEnd: Return report
    FrontEnd -->> User: Return report
    deactivate OAS
    deactivate User




    deactivate FrontEnd