Skip to main content
Version: CESC

Vendor Management

Author(s)

  • Reshmi Karan

Last Updated Date

2024-12-09


SRS References

NO


Version History

VersionDateChangesAuthor
1.02024-12-09Initial draftReshmi Karan
............

Feature Overview

Objective:
This feature aims to facilitate efficient vendor management within specific divisions. It enables CRUD operations on vendor data, status updates, and ensures compliance with organizational and legal standards.

Scope:

  • Each division can access its own vendors.

  • The head department and system owner can view all vendors.

  • Department-level access is restricted to the vendors of the respective division.

Dependencies:


Requirements

  • Enable CRUD operations on vendor records.

  • Support filtering, sorting, and paginated vendor listings.

  • Facilitate uploading and managing vendor-related documents.

  • Allow status updates for vendor records.

  • Ensure secure and validated API interactions.

  • Provide paginated GET API with sorting capabilities based on frontend inputs.

  • Implement Excel export functionality for vendor data.


Design Specifications

  • UI/UX Design:

  • Data Models:

    public record Vendor
    {
    public Guid VendorId { get; set; }
    public string? VendorCode { get; set; }
    public string? VendorName { get; set; }
    public string? EstablishmentNumber { get; set; }
    public string? PhoneNumber { get; set; }
    public string? EmailAddress { get; set; }
    public List<VendorSourceDetail> DivisionDeptWithStatus { get; set; } = [];// Jsonb fields can be represented as string or a specific class if deserialized.
    public DateTime? CreatedAt { get; set; }
    public DateTime? UpdatedAt { get; set; }
    public string? RegistrationNumber { get; set; }
    public DateTime DateOfRegistration { get; set; }
    public string? TaxIdentificationNumber { get; set; }
    public string? PanNumber { get; set; }
    public string? GstNumber { get; set; }
    public List<FileInformation> Files { get; set; } = [];// Jsonb fields can be represented as string or a specific class if deserialized.
    public string? LogUserName { get; set; }
    public List<Location> Locations { get; set; } = new List<Location>();
    public CompanyType CompanyType { get; set; } = default!;
    public VendorStatus Status { get; set; } = default!;
    public ComplianceStatus ComplianceStatus { get; set; } = default!;
    [System.Text.Json.Serialization.JsonIgnoreAttribute]
    public int TotalNumber { get; set; }
    }
    public record VendorSourceDetail: DivisionDepartmentMapping
    {
    public VendorStatus? Status { get; set; }
    }
    public record FileWithType
    {
    public IFormFile File { get; set; }
    public FileType FileType { get; set; }
    }
    public class FileInformation
    {
    public string? FileId { get; set; }
    public FileType FileType { get; set; }
    }
    public record VendorStatusFilter
    {
    public Guid VendorId { get; set; }
    public VendorStatus Status { get; set; }
    }
    public record VendorFilterParam : SortingPaginatedData
    {
    public Guid? VendorId { get; init; }
    public int PageNumber { get; set; }
    public int RowsPerPage { get; set; }
    public string? VendorName { get; init; }
    public string? VendorCode { get; init; }
    public required Guid DivisionId { get; set; }
    public Guid? DepartmentId { get; init; }
    public string? PanNumber { get; init; }
    public string? GstNumber { get; init; }
    public VendorStatus? Status { get; init; }
    public AddressForFilter? Address { get; init; }
    public bool IsExcel { get; init; }
    public override IEnumerable<string> AllowedSortByFields => new[]
    {
    "VendorName",
    "VendorCode",
    "Status",
    "DivisionName",
    "CompanyType"
    };
    }
    public record AddressForFilter
    {
    public string? City { get; init; }
    public string? District { get; init; }
    public string? State { get; init; }
    public string? PinCode { get; init; }
    public string? Country { get; init; }
    }
    public abstract record SortingPaginatedData
    {
    public abstract IEnumerable<string> AllowedSortByFields { get; }
    public string? SortBy { get; set; }
    [AllowedValues("asc", "desc")]
    public string SortingOrder { get; set; } = "asc";
    public bool IsValidSortBy()
    {
    return SortBy == null || AllowedSortByFields.Contains(SortBy, StringComparer.OrdinalIgnoreCase);
    }
    }
    public class ServerPaginatedData<T>
    {
    public List<T>? Data { get; set; }
    public long Totalnumber { get; set; }
    }
    public enum FileType
    {
    Unknown,
    Aadhar,
    GST,
    PAN,
    }
    public enum LocationType
    {
    None = 0,
    RegisteredAddress = 1,
    OfficeAddress = 2,
    }
    public enum VendorStatus
    {
    InActive = 0,
    Active = 1,
    BlackListed = 2
    }
    public enum CompanyType
    {
    [Description("Limited Liability Partnership (LLP)")]
    LimitedLiabilityPartnership = 0,
    [Description("Private Limited Company (P.L.C)")]
    PrivateLimitedCompany = 1,
    [Description("One Person Company (OPC)")]
    OnePersonCompany = 2,
    [Description("Partnership Firm (PF)")]
    PartnershipFirm = 3,
    [Description("Government Company")]
    GovernmentCompany = 4,
    }
    public enum ComplianceStatus
    {
    None = 0,
    Compliant = 1,
    NonCompliant = 2,
    Pending = 3
    }
  • API Interfaces:

    EndpointMethodParametersResponseResponse Status Codes
    /api/Vendor/getGETvendorId (required, Guid)List of Vendor200, 204, 500
    /api/Vendor/setPOSTVendor (required)String (Message)200, 204, 500
    /api/Vendor/updatePUTVendor (required)String (Message)201, 204, 500
    /api/Vendor/get/allGETVendorFilterParam (required)ServerPaginatedData<Vendor>200, 204, 500
    /api/Vendor/status-updatePUTVendorStatusFilter (required)List<FileInformation>200, 204, 500
    /api/Vendor/file/uploadPOSTvendorId (required, Guid), List<FileWithType>String (Message)200, 204, 500
    /api/Vendor/file/delete/{fileId}DELETEvendorId (required, Guid), fileId(required,string)String (Message)200, 204, 500
  • Third-Party Integrations:

  • Workflow:

    1. Adding a New Vendor:

    • Admin/division fills out the form with vendor details

    • Optionally uploads supporting documents (e.g., PAN, GST).

    1. Editing Vendor Details:

    • Admin selects an existing vendor record.

    • Updates vendor details, including contact information, division mappings, and compliance status.

    1. Status Updates:

    • Admin changes the vendor's status to "Active," "Inactive," or "Blacklisted."

    1. Uploading and Managing Documents:

    • Admin uploads documents linked to the vendor (e.g., GST Certificate, PAN).

    • Documents are validated for type and size before being stored.

    • Admin can view and delete previously uploaded documents.

    1. Filtering and Searching Vendors:

    • Users can filter vendors by criteria.

    • Results are displayed in a paginated table.

    • Exporting Vendor Data


Development Tasks & Estimates

NoTask NameEstimate (Hours)DependenciesNotes
1Vendor Management: Get paginated api4 hourswith excel export and sorting
2Vendor Management: Get api by Id2.5 hours
3Vendor Management: Set Vendor3 hours
4Vendor Management: Update Vendor3 hours
5Vendor Management: Update status2.5 hours
6Vendor Management: File Upload3 hours
7Vendor Management: File Delete2.5 hours
8Total20.5 hours

Testing & Quality Assurance

  • Unit Tests:

    1. Vendor Retrieval:
      • Verify retrieval of vendor details by ID.
      • Test edge cases such as invalid or non-existent vendor IDs.
    2. Vendor CRUD Operations:
      • Test create, read, update, and delete operations for vendors.
      • Verify proper error handling for invalid inputs.
    3. Vendor Status Update:
      • Test status change functionality (e.g., active, inactive) for vendors.
      • Ensure validation rules are respected during status updates.
    4. File Upload & Deletion:
      • Test successful file upload scenarios.
      • Verify handling of invalid file types.
      • Ensure file deletion works with valid file IDs and handles edge cases.
    5. Pagination & Filtering:
      • Test vendor filtering with pagination parameters.
      • Verify edge cases like no results found or invalid pagination parameters.
    6. Error Handling:
      • Validate that proper error responses are returned for database failures and invalid requests.
  • Integration Tests:

  • Acceptance Criteria:

  • Testing Tools:
    Scalar for API testing.


Deployment Considerations

  • Configuration Changes:
CREATE Table tblvendor (
vendor_id UUID,
vendorcode text unique,
vendor_name TEXT,
establishment_id TEXT unique,
phone_number TEXT UNIQUE,
email_address TEXT UNIQUE,
created_at TIMESTAMPTZ,
updated_at TIMESTAMPTZ,
division_dept jsonb,--list of division-department --'Active' or diasable
registration_number text unique,
tax_identification_number text unique,
Pan text unique,--pan or tan
GST text unique,
companytype text,
Files jsonb,
logusername TEXT,
dateofregistration TIMESTAMPTZ,
CONSTRAINT tblvendor_pkey PRIMARY KEY (vendor_id)
);
CREATE Table tbllocation
(
location_id uuid,
participant_id uuid not null,
type text, -- division or vendor or hQ or department or employee
location_type text,
addressline1 text,
addressline2 text,
city text,
state text,
pincode text,
country text,
status text,
created_at TIMESTAMPTZ,
logusername TEXT,
CONSTRAINT tbllocation_pkey PRIMARY KEY (location_id)
);
CREATE INDEX idx_tbllocation_participant_id ON tbllocation(participant_id);

CREATE Table tblcontactdetails
(
contact_id uuid,
participant_id uuid,
type text, --//division or vendor or hq or department
name text,
email text,
phone text,
whatsappnumber text,
isuser boolean,
logusername text,
logdts TIMESTAMPTZ,
CONSTRAINT tblcontactdetails_pkey PRIMARY KEY (contact_id)
);
CREATE INDEX idx_tblcontactdetails_participant_id ON tblcontactdetails(participant_id);
  • Rollout Plan:

Risks & Mitigations


Review & Approval

(Include a section for review and approval by stakeholders.)

  • Reviewer:
    Abhishak Kumar Roy

  • Approval Date:
    2024-12-09


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