# Definizione endpoint Budget Flow ## Authentication ### POST /authentication/register Aggiungere un nuovo utente (solo utenti autenticati possono aggiungere un utente) #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { username: string, password: string, name: string, surname: string, level: 'office' | 'admin' } ``` #### Result ```typescript= { id: string, createDateTime: IsoDate, createdBy: string, lastChangedDateTime: IsoDate, lastChangedBy: string, username: string, password: string, name: string, surname: string, level: 'office' | 'admin' } ``` --- ### POST /authentication/log-in Fornisce i dati dell'utente loggato e il token generato. #### Body ```typescript= { username: string, password: string } ``` #### Result ```typescript= { user: { id: string, createDateTime: IsoDate, createdBy: string, lastChangedDateTime: IsoDate, lastChangedBy: string, username: string, password: string, name: string, surname: string, level: 'office' | 'admin' }, token: string } ``` --- ## Budget ### GET /budget Fornisce le informazioni principali dei budget relitivi al filtro richiesto. #### Query params | Name | Description | Type | Default Value | Required | | ------- | --------------------------------- | -------- | -------------- | -------- | | pages | Current page of results | number | 0 | No | | q | Query term | string | `empty string` | No | | results | Number of results of current page | number | 5 | No | | type | Type of Budget | string[] | all | No | | user | User that do | string | all | No | #### Headers - Authentication: bearer <jwt_token> #### Results ```typescript { createdBy: string, createDateTime: IsoDate, description: string, endMonth: integer, lastChangedDateTime: IsoDate, lastChangedBy: string, name: string, startMonth: integer, budgetSteps: { done: boolean, sequence: integer, step: string, id:string }[], type: 'forecast' | 'balance', id: string, }[] ``` --- ### GET /budget/{uuid} Fornisce le informazioni principali del budget con UUID richiesto. #### Headers - Authentication: bearer <jwt_token> #### Results ```typescript= { createdBy: string, createDateTime: IsoDate, description: string, endMonth: integer, lastChangedDateTime: IsoDate, lastChangedBy: string, name: string, startMonth: integer, budgetSteps: { done: boolean, sequence: integer, step: string, id:string }[], type: 'forecast' | 'balance', id: string, } ``` --- ### POST /budget Crea una nuova entità Budget. #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { description: string, endMonth: integer, name: string, startMonth: integer, type: 'forecast' | 'balance', } ``` #### Results ```typescript= { createdBy: string, createDateTime: IsoDate, description: string, endMonth: integer, lastChangedDateTime: IsoDate, lastChangedBy: string, name: string, startMonth: integer, budgetSteps: { done: boolean, sequence: integer, step: string, id:string }[], type: 'forecast' | 'balance', id: string, } ``` --- ### PUT /budget Modifica un entità Budget. #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { description: string, name: string, } ``` #### Results ```typescript= { createdBy: string, createDateTime: IsoDate, description: string, endMonth: integer, lastChangedDateTime: IsoDate, lastChangedBy: string, name: string, startMonth: integer, budgetSteps: { done: boolean, sequence: integer, step: string, id:string }[], type: 'forecast' | 'balance', id: string, } ``` --- ### Budget Items #### GET /budgets/:budgetId/items Visualizza gli articoli del budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { createdBy: string, createDateTime: IsoDate, category: string, code: string, description: string, id: string, itemType: 'PF' | 'SL' | 'MP' | 'CP', lastChangedDateTime: IsoDate, lastChangedBy: string, unitOfMeasure: string, uuidBudget: string }[] ``` --- #### GET /budgets/:budgetId/items/:itemId Un articolo del budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { createdBy: string, createDateTime: IsoDate, category: string, code: string, description: string, id: string, itemType: 'PF' | 'SL' | 'MP' | 'CP', lastChangedDateTime: IsoDate, lastChangedBy: string, unitOfMeasure: string, uuidBudget: string } ``` --- #### POST /budgets/:budgetId/items Crea nuovo articolo budget #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { category: string, code: string, description: string, itemType: 'PF' | 'SL' | 'MP' | 'CP', unitOfMeasure: string, uuidBudget: string } ``` #### Result ```typescript= { createdBy: string, createDateTime: IsoDate, category: string, code: string, description: string, id: string, itemType: 'PF' | 'SL' | 'MP' | 'CP', lastChangedDateTime: IsoDate, lastChangedBy: string, unitOfMeasure: string, uuidBudget: string } ``` --- #### GET /budgets/:budgetId/items/:idItem/bom Fornisce la distinta base di uno specifico articolo #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { //TODO } ``` --- ### Budget Items Imports #### POST /budgets/:budgetId/items/import Importa gli articoli selezionati nel budget Comportamento - selection true: importa gli articoli nell' array codes #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { selection: boolean, codes: string[], } ``` #### Result ```typescript= { count: number, } ``` --- #### POST /budgets/:budgetId/items/import/bom Importa la distinta base degli articoli selezionati. #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { } ``` #### Result ```typescript= { count: number, } ``` --- #### POST /budgets/:budgetId/items/import/trade-data Importa i dati commerciali degli articoli selezionati. #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { } ``` #### Result ```typescript= { count: number, } ``` --- #### DELTE /budgets/:budgetId/items/import Cancella tutti i dati importati rispetto alle anagrafiche articolo, distinte base e dati commerciali. Comportamento - selection true: importa gli articoli nell' array codes #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count: number, } ``` --- ### Budget Divisions #### GET /budgets/:budgetId/divisions Visulizza le divisioni associate al budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { budgetId: string, code: string, createdBy: string, createDateTime: IsoDate, id: string, lastChangedDateTime: IsoDate, lastChangedBy: string, }[] ``` #### ```Changed``` POST /budgets/:budgetId/divisions/import Importa le divisioni per il budget #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript { selection: boolean, codes: string[], } ``` #### Result ```typescript= { count: number, }[] ``` --- ### Divisions Calendar #### GET /budgets/:budgetId/calendar Visulizza le divisioni associate al budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { id: string, uuidBudget: string, year: integr, month: integer, }[] ``` #### GET /budgets/:budgetId/divisions/:divisonId/stops Visulizza le divisioni associate al budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { id: string, data: IsoDate, description: string, divisionUuid: string hours: integer, uuidBudget: string, uuidMonthlyCalendar: string, calendar: { id: string, uuidBudget: string, year: integr, month: integer, } }[] ``` --- #### POST /budgets/:budgetId/divisions/:divisonId/stops Visulizza le divisioni associate al budget #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { data: IsoDate, description: string, hours: integer, budgetId: string, monthlyCalendarId: string, } ``` #### Result ```typescript= { id: string, data: IsoDate, description: string, divisionUuid: string hours: integer, budgetId: string, monthlyCalendarId: string, } ``` --- ### Fixed Cost #### GET /budgets/:budgetId/fixed-costs Fornisce i costi fissi indiretti #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { id: string, description: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, }[] ``` #### POST /budgets/:budgetId/fixed-costs Creazione nuovo costo fisso indiretto #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { description: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` #### Result ```typescript= { id: string, description: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` #### PUT /budgets/:budgetId/fixed-costs/:costId Modifica costo fisso indiretto #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { description?: string, value?: numeric, } ``` #### Result ```typescript= { id: string, description: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` #### DELETE /budgets/:budgetId/fixed-costs/:costId Elimina costo fisso indiretto #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` --- #### POST /budgets/:budgetId/fixed-costs/import Importa costi fissi diretti da consuntivo asytrack #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` --- #### POST /budgets/:budgetId/fixed-costs/import-mean Importa costi fissi diretti medi da asytrack #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { startMonth: integer, endMonth: integer, } ``` #### Result ```typescript= { count:number } ``` --- --- ### Division Cost #### GET /budgets/:budgetId/division-costs Fornisce i costi fissi diretti #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { id: string, description: string, divisionUuid: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, }[] ``` --- #### POST /budgets/:budgetId/division-costs Creazione nuovo costo fisso diretto #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { description: string, divisionUuid: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` #### Result ```typescript= { id: string, description: string, divisionUuid: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` --- #### PUT /budgets/:budgetId/division-costs/:costId Modifica costo fisso diretto #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { description?: string, value?: numeric, } ``` #### Result ```typescript= { id: string, description: string, divisionUuid: string, value: numeric, uuidBudget: string, uuidMonthlyCalendar: string, } ``` #### DELETE /budgets/:budgetId/division-costs/:costId Elimina costo fisso diretto #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` #### POST /budgets/:budgetId/division-costs/import Importa costi fissi diretti da consuntivo asytrack #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` --- #### POST /budgets/:budgetId/division-costs/import-mean Importa costi fissi diretti medi da asytrack #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { startMonth: integer, endMonth: integer, } ``` #### Result ```typescript= { count:number } ``` --- --- ### Production volumes #### POST /budgets/:budgetId/production-volumes/import Importa i volumi di produzione consuntivi del budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` #### POST /budgets/:budgetId/production-volumes/import-mean Importa la media dei volumi di produzione del budget #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { startMonth: integer, endMonth: integer, } ``` #### Result ```typescript= { count:number } ``` --- --- ### Production Consumptions #### POST /budgets/:budgetId/production-consumptions/import Importa i consumi consuntivi imputabili al budget #### Headers - Authentication: bearer <jwt_token> #### Result ```typescript= { count:number } ``` #### POST /budgets/:budgetId/production-consumptions/import-mean Importa le medie dei consumi imputabili al budget #### Headers - Authentication: bearer <jwt_token> #### Body ```typescript= { startMonth: integer, endMonth: integer, } ``` #### Result ```typescript= { count:number } ``` ### Budget calculation // **TODO** Definizione delle chiamate per gli step "calcolo del budget" --- --- --- # Import Views ### Items #### GET /import/items Fornisce la lista degli articoli finiti. #### Query params | Name | Description | Type | Default Value | Required | | -------- | --------------------------------- | -------- | -------------- | -------- | | search | Query term | string | `empty string` | No | | category | Category of item | string | `empty string` | No | | type | Type of item | string | `empty string` | No | #### Result ```typescript= { category: string, code: string, description: string, itemType: 'PF' | 'SL' | 'MP' | 'CP', unitOfMeasure: string, }[] ``` ### Divisions #### GET /import/divisions Fornisce la lista delle divisioni importabili. | Name | Description | Type | Default Value | Required | | -------- | --------------------------------- | -------- | -------------- | -------- | | search | Search term | string | `empty string` | No | | active | Resource active flag | string | all | No | #### Result ```typescript { code: string, description: string, active: boolean } ```