Vendor Management
Author(s)
- Reshmi Karan
Last Updated Date
2024-12-09
SRS References
NO
Version History
| Version | Date | Changes | Author |
|---|---|---|---|
| 1.0 | 2024-12-09 | Initial draft | Reshmi 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:
Endpoint Method Parameters Response Response 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:
-
Adding a New Vendor:
-
Admin/division fills out the form with vendor details
-
Optionally uploads supporting documents (e.g., PAN, GST).
-
Editing Vendor Details:
-
Admin selects an existing vendor record.
-
Updates vendor details, including contact information, division mappings, and compliance status.
-
Status Updates:
-
Admin changes the vendor's status to "Active," "Inactive," or "Blacklisted."
-
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.
-
Filtering and Searching Vendors:
-
Users can filter vendors by criteria.
-
Results are displayed in a paginated table.
-
Exporting Vendor Data
-
Development Tasks & Estimates
| No | Task Name | Estimate (Hours) | Dependencies | Notes |
|---|---|---|---|---|
| 1 | Vendor Management: Get paginated api | 4 hours | with excel export and sorting | |
| 2 | Vendor Management: Get api by Id | 2.5 hours | ||
| 3 | Vendor Management: Set Vendor | 3 hours | ||
| 4 | Vendor Management: Update Vendor | 3 hours | ||
| 5 | Vendor Management: Update status | 2.5 hours | ||
| 6 | Vendor Management: File Upload | 3 hours | ||
| 7 | Vendor Management: File Delete | 2.5 hours | ||
| 8 | Total | 20.5 hours |
Testing & Quality Assurance
-
Unit Tests:
- Vendor Retrieval:
- Verify retrieval of vendor details by ID.
- Test edge cases such as invalid or non-existent vendor IDs.
- Vendor CRUD Operations:
- Test create, read, update, and delete operations for vendors.
- Verify proper error handling for invalid inputs.
- Vendor Status Update:
- Test status change functionality (e.g., active, inactive) for vendors.
- Ensure validation rules are respected during status updates.
- 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.
- Pagination & Filtering:
- Test vendor filtering with pagination parameters.
- Verify edge cases like no results found or invalid pagination parameters.
- Error Handling:
- Validate that proper error responses are returned for database failures and invalid requests.
- Vendor Retrieval:
-
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.)