CodeFlow-Inc / CodeFlow-Inc/ExpensesControl
Create Route for Post ImportRevenue
- Ngôn ngữ chính
- C#
- Star
- 1
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### 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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu từ Revenue controller và lần theo pattern xử lý request hiện có của MediatR. Xác định entry point POST /Revenue/import dựa trên IFormFile, sau đó kiểm tra định dạng CSV, các cột bắt buộc và kiểu dữ liệu trước khi xử lý các bản ghi. Hoàn tất khi các import hợp lệ trả về bản tóm tắt 200, còn các tệp không hợp lệ hoặc thao tác thất bại trả về 400 cùng các lỗi hữu ích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp
- Lĩnh vực
- api, backend
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100