Files
OCR/frontend_integration.md
2026-05-21 21:33:37 +05:30

75 lines
2.1 KiB
Markdown

# Vendor and Vendor Branch Integration Guide
This document outlines the API endpoints and TypeScript interfaces to help integrate the Vendor and Vendor Branch features into your frontend project.
## 1. API Endpoints
**Base URL**: `/cygnus/app/api/v1/account/vendor/vendors`
| Method | Endpoint | Description | Payload |
|---|---|---|---|
| POST | `/` | Create or Update Vendor | `VendorDTO` |
| GET | `/` | Get All Vendors | (Query Params) |
| POST | `/search` | Search Vendors | `SearchDTO` |
| GET | `/{id}/branches` | Get Branches for Vendor | - |
| POST | `/{id}/branches` | Create or Update Branch | `VendorBranchDTO` |
| DELETE | `/{id}/branches/{branchId}` | Delete Branch | - |
## 2. TypeScript Interfaces
### Vendor
```typescript
export interface VendorDTO {
id?: string;
companyId?: string; // Encrypted Company ID
code: string;
name: string;
panNo?: string;
cinNo?: string;
msmeNo?: string;
createdUser?: string;
updatedAt?: string; // ISO Date String
updatedUser?: string;
active: boolean;
branches?: VendorBranchDTO[];
}
```
### Vendor Branch
```typescript
export interface VendorBranchDTO {
id?: string;
fkVendorId?: string; // Encrypted Vendor ID
branchCode: string;
branchName: string;
officeNo?: string;
street?: string;
locality?: string;
cityId?: string; // Encrypted City ID
stateId?: string; // Encrypted State ID
stateName?: string;
cityName?: string;
pinCode?: string;
emailId?: string;
contactNo?: string;
contactPerson?: string;
gstNo?: string;
createdUser?: string;
updatedAt?: string; // ISO Date String
updatedUser?: string;
active: boolean;
}
```
## 3. Usage Notes
- **IDs**: All IDs (`id`, `fkVendorId`, `companyId`, `cityId`, `stateId`) are strings and represent encrypted values.
- **Dates**: `updatedAt` is returned as an ISO string.
- **Search**: The search endpoint uses `SearchDTO` (likely existing in your frontend common types) to handle filters and pagination.
## Context Transfer
To reference this backend implementation context in another conversation, mention the **Conversation ID**:
`496255c5-4ca5-4e1d-908f-c9d456a6dfb8`