Skip to main content
Version: Fleeto

Bulk Upload System

Author(s)

  • SANKET MAL
  • AYAN GHOSH
  • RESHMI KARAN

Last Updated Date

2025-02-05


SRS References


Version History

VersionDateChangesAuthor
1.02025-02-05Initial draftSanket Mal, Ayan Ghosh, Reshmi Karan

Feature Overview

Objective:
The goal of this feature is to implement a generic bulk upload solution for multiple data categories within the inventory management system. Users will be able to download predefined Excel templates, populate them with data, and then upload them for processing. The system will handle data validation, insertion, and updates, while ensuring proper error handling, conflict resolution, and process synchronization.

Scope:

  • Supported Data Categories: The feature will be available across multiple inventory-related data categories (e.g., Catalog, Config, SKU, etc).

  • Excel Format: Each category will have a unique Excel template that users must follow.

  • File Upload & Storage:

    • Uploaded files are stored in a Docker container with a unique filename (uniqueId.csv).
    • Metadata is stored in a database, including filename, upload date, status, uploader, and category name.
  • File History:

    • Users can view previously uploaded files in a paginated history section.
    • History is filtered based on the data category (e.g., Catalog, Config, SKU).
  • File Preview & Processing:

    • Files have one of the following statuses:
      1. ReadyToProcess: File is uploaded but not yet processed.
      2. Processing: Data validation and database operations are in progress.
      3. Processed: Data has been successfully inserted/updated.
      4. Failed: An error occurred, and no changes were committed.
    • Users can preview files before processing to see:
      1. New records (to be inserted).
      2. Existing records (to be updated).
      3. Conflicts (If conflicts exist, the user cannot proceed).
    • When confirmed, the file status updates:
      1. ReadyToProcess → Processing during execution.
      2. Processing → Processed after successful completion.
      3. Processing → Failed if any issues occur (with rollback).
  • Processing Restriction:

    • If any file is in Processing state, no other file from the same data category can be processed simultaneously.
    • No manual insert or update operations will be allowed for that particular section while a file is being processed.
  • Background Scheduler for Process Timeout:

    • A background scheduler will run every 1 hour to check for stuck processes.
    • If a file is in Processing state for more than 1 hour, it will be automatically marked as Failed.

Dependencies:


Requirements

  1. File Upload API

    • Must allow users to upload Excel files following the predefined template.
    • Save files in a Docker container and record metadata in the database.
    • Assign a unique identifier to each uploaded file.
  2. File History API

    • Fetch uploaded file records based on the selected data category.
    • Implement pagination for efficient retrieval.
  3. File Preview API

    • Read uploaded file content and categorize records into 1. New inserts , 2. Updates and 3.Conflicts.
    • If conflicts exist, prevent the user from proceeding.
  4. File Processing API

    • Change the file status to Processing when confirmation is received.
    • Perform insert/update operations in a single transaction.
    • If an error occurs, rollback changes and update the status to Failed.
    • If successful, update the status to Processed.
  5. Processing Restriction

    • If any file is in Processing state, no other file from the same category can be processed.
    • No manual insert or update operations are allowed in the database for that category while a file is being processed.
  6. Background Scheduler for Process Timeout

    • A background scheduler will run every 1 hour to check if any process is stuck in Processing state.
    • If a file has been in Processing state for more than 1 hour, it will be automatically marked as Failed.

Design Specifications

(Provide detailed design specifications, including UI/UX designs, API interfaces, and any other relevant architectural details.)

  • UI/UX Design: warranty management ui

  • Workflow:
    warranty management ui

  • Data Models:

    public enum BulkUploadCategory
    {
    Catalog = 1,
    Config = 2,
    SKU = 3,
    All = 99
    }
    public enum FileStatus
    {
    ReadyToProcess = 1,
    Processing = 2,
    Processed = 3,
    Failed = 4,
    All = 99
    }
    public record BulkUploadFileResult(
    string ActualFileName,
    bool IsSuccess,
    string? UniqueFileName,
    string? FailReason,
    BulkUploadCategory? Category
    );
    public record PreviewResponse<T>
    {
    public List<T>? Insert { get; init; }
    public List<T>? Update { get; init; }
    public List<T>? Conflict { get; init; }
    }
    public record FileHistoryFilter
    {
    [Required]
    public BulkUploadCategory Category { get; init; }
    public FileStatus FileStatus { get; init; }
    public DateTime? UploadFrom { get; set; }
    public DateTime? UploadTo { get; set; }
    public DateTime? ProcessFrom { get; set; }
    public DateTime? ProcessTo { get; set; }
    public int PageNumber { get; set; }
    public int RowsPerPage { get; set; }
    }
    public record FileMetaData
    {
    public Guid FileId { get; set; }
    public string? ActualFileName { get; init; }
    public string? UniqueFileName { get; set; }
    public BulkUploadCategory Category { get; init; }
    public FileStatus FileStatus { get; init; }
    public DateTime? UploadedAt { get; set; }
    public string? UploadedBy { get; init; }
    public DateTime? ProcessStartAt { get; set; }
    public DateTime? ProcessEndAt { get; set; }
    public string? ProcessedBy { get; init; }
    [System.Text.Json.Serialization.JsonIgnore]
    [Newtonsoft.Json.JsonIgnore]
    public int TotalNumber { get; set; }
    }
    public record FormatInfo
    {
    public Guid FormatId { get; set; }
    public string ActualFileName { get; init; }
    public string UniqueFileName { get; set; }
    public BulkUploadCategory Category { get; set; } // Example: "Catalog", "Config", "SKU"
    public DateTime UploadedAt { get; set; } = DateTime.UtcNow;
    public string? UploadedBy { get; set; }
    }

    public record UploadConfirmRequest
    {
    public required string UniqueFileName { get; init; }
    public required BulkUploadCategory Category { get; init; }
    }
    public record MessageResponse
    {
    public string Message { get; init; }
    }

  • API Interfaces:
    (Define the APIs required for this feature, including endpoints, methods, request/response formats.)

    EndpointMethodParametersResponseResponse Status Codes
    /api/inventory/product/upload/{category}POSTBulkUploadCategory(category), IFormFile(file)BulkUploadFileResult200, 400, 403, 404, 500
    /api/inventory/product/files/{category}POSTFileHistoryFilterServerPaginatedData<FileInfo>200, 204, 500
    /api/inventory/product/upload/preview/{category}GETBulkUploadCategory(category), string (uniqueFileName)PreviewResponse<T>200, 400, 403, 404, 500
    /api/inventory/product/upload/confirmPOSTUploadConfirmRequestMessageResponse200, 400, 403, 404, 500
    /api/inventory/product/upload/format/{category}POSTBulkUploadCategory(category), IFormFile(file)MessageResponse200, 400, 403, 404, 500
    /api/inventory/product/download/format/{category}GetBulkUploadCategory(category)FileContentResult200, 400, 403, 404, 500
  • Third-Party Integrations:
    (List any third-party services or tools that need to be integrated.)

  • Workflow:
    (Describe the end-to-end workflow of the feature, detailing how different components interact, including the sequence of events, data flow, and the user journey.)


Development Tasks & Estimates

NoTask NameEstimate (Hours)DependenciesNotes
1Save(Insert And Update) File History5 hours
2Testing File History API2 hoursTask 1
3File Upload API5 hoursUpload Excel files into Docker container, store file metadata in database.
4Testing File Upload API2 hoursTask 3
5Get File History API (Paginated View)6 hoursPaginated file history API to fetch file records based on category.
6Testing Get File History API2 hoursTask 5
7Upload Preview API8 hoursCreate logic to preview the file before processing, categorize data into Insert, Update, and Conflict.
8Testing Preview API2 hoursTask 7
9Upload Confirm API (Processing & Rollback)8 hoursImplement API to confirm the upload and perform insert/update operations. Handle errors and rollback if necessary.
10Testing Upload Confirm API2 hoursTask 9
11Format Upload API4 hoursImplement the upload API for format files.
12Testing Format Upload API2 hoursTask 12
13Save (Insert & Update) Format API6 hours
14Testing Save Format API2 hoursTask 13
15Download Format API4 hours
16Testing Download Format API1 hoursTask 15
17Add Validation for Excel Files6 hoursAdd validation logic to ensure uploaded Excel files follow the correct format and also other validation.
18Restrict manual insertion at the time of Processing in Add Catalog API3 hoursPrevent manual additions or updates to Catalog data while any Catalog related file bulk upload in processing state.
19Test: Add Catalog API3 hours
20Restrict manual insertion at the time of Processing in Add Config API3 hoursPrevent manual additions or updates to Config data while any Config related file bulk upload in processing state. active.
21Test: Add Config API1 hours
22Implement a Background Scheduler for Process Timeout6 hoursBackground job to detect stuck processes and mark them as failed.
23Test: Background Scheduler for Process Timeout2 hoursTask 22Validate that processes exceeding the time limit are marked as failed.
24Update Config Price API4 hours
25Test: Update Config Price API1 hoursTask 24
26Update Catalog API4 hours
27Test: Update Catalog API1 hoursTask 26
28Update Config API4 hours
29Test: Update Config API1 hoursTask 28
30Integration Tests for Bulk Upload Feature8 hoursTask 29
Frontend
31Create File Import Dialog4hrTask 30
32Create File Import History Dialog3hrTask 31
33File Import History List4hrTask 32
34Filter History3hrTask 33
35Insert Data Preview4hrTask 34
36Update Data Preview4hrTask 35
37Conflict Data Preview4hrTask 36
38Download Excel Format2hrTask 37
Total136 hours

Testing & Quality Assurance

(Outline the testing strategy and quality assurance measures for the feature.)

  • Unit Tests:
    (List the unit tests that will be written for this feature.)

  • Integration Tests:
    (Describe how integration testing will be conducted.)

  • Acceptance Criteria:
    (Define the criteria that must be met for the feature to be considered complete.)

  • Testing Tools:
    (List any tools that will be used for testing.)


Deployment Considerations

(Describe any deployment considerations, including environment configurations, feature toggles, or migration steps.)

  • Configuration Changes:

      CREATE TABLE tblFileHistory (
    FileId UUID NOT NULL,
    ActualFileName TEXT NOT NULL,
    UniqueFileName TEXT NOT NULL UNIQUE,
    Category TEXT NOT NULL, -- (Example values: 'Catalog', 'Config', 'SKU')
    FileStatus TEXT NOT NULL, -- (ReadyToProcess, Processing, Processed, Failed)
    UploadedAt TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    UploadedBy TEXT NOT NULL,
    ProcessStartAt TIMESTAMP WITH TIME ZONE NULL,
    ProcessEndAt TIMESTAMP WITH TIME ZONE NULL,
    ProcessedBy TEXT NULL
    );

    CREATE TABLE tblFormat (
    FormatId UUID NOT NULL,
    ActualFileName TEXT NOT NULL,
    UniqueFileName TEXT NOT NULL UNIQUE,
    Category TEXT NOT NULL, -- (Example values: 'Catalog', 'Config', 'SKU')
    UploadedAt TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
    UploadedBy TEXT NOT NULL
    );



  • Rollout Plan:
    (Outline the plan for rolling out the feature, including any phased releases.)


Risks & Mitigations

(Identify potential risks and the strategies to mitigate them.)

RiskImpactLikelihoodMitigation Strategy

Review & Approval

  • Reviewer:
    Abhishak Kumar Roy

  • Approval Date:
    2025-02-07


Notes
(Add any additional notes or considerations related to the feature development here.)