CodeFlow-Inc / CodeFlow-Inc/ExpensesControl

Create Route for Post ImportRevenue

Offen
#37 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement help wanted
Vorherrschende Sprache
C#
Sterne
1
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Title: Create Route for Post ImportRevenue

#### Description:
Develop the `POST /Revenue/import` endpoint to handle importing revenue records from a CSV file. The endpoint should accept a CSV file through a `FormFile`, validate the file format and contents, and return the results of the import process.

#### Acceptance Criteria:

1. **Route Implementation**
- Create the `POST /Revenue/import` route in the controller.
- Ensure the method accepts a CSV file through the `IFormFile` object from the request.

2. **File Validation and Processing**
- Validate that the uploaded file is in CSV format.
- Validate the structure and contents of the CSV file (e.g., required columns, valid data types).
- Use MediatR to process the imported data.

3. **Response Handling**
- Return `200 OK` with a summary of the import results (e.g., number of records processed, successful, and failed).
- Return `400 Bad Request` with appropriate error messages if the operation fails or the file is invalid.

---

### Título: Criar Rota para Post ImportRevenue

#### Descrição:
Desenvolver o endpoint `POST /Revenue/import` para importar registros de receitas a partir de um arquivo CSV. O endpoint deve aceitar o arquivo através de um `FormFile`, validar o formato e o conteúdo do arquivo, e retornar os resultados do processo de importação.

#### Critérios de Aceite:

1. **Implementação da Rota**
- Criar a rota `POST /Revenue/import` no controlador.
- Garantir que o método aceite um arquivo CSV através do objeto `IFormFile` na requisição.

2. **Validação e Processamento do Arquivo**
- Validar se o arquivo enviado está no formato CSV.
- Validar a estrutura e o conteúdo do CSV (ex.: colunas obrigatórias, tipos de dados válidos).
- Utilizar o MediatR para processar os dados importados.

3. **Tratamento de Respostas**
- Retornar `200 OK` com um resumo dos resultados da importação (ex.: número de registros processados, bem-sucedidos e falhos).
- Retornar `400 Bad Request` com mensagens de erro apropriadas caso a operação falhe ou o arquivo seja inválido.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.