tvpl.api

<back to all web services

SearchProcurementItemRequest

Requires Authentication
The following routes are available for this service:
GET/procurement/item/search
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PagingRequest:
    page: int = 0
    limit: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SearchProcurementItemRequest(PagingRequest):
    batch_id: int = 0
    department_id: Optional[int] = None
    approval_status: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MongoObject(IMongoModel):
    id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AuditLog(MongoObject, IEntityId, ICreated, IUpdate):
    user_name: Optional[str] = None
    user_id: Optional[int] = None
    document_id: int = 0
    action: Optional[str] = None
    description: Optional[str] = None
    created_date: datetime.datetime = datetime.datetime(1, 1, 1)
    updated_date: datetime.datetime = datetime.datetime(1, 1, 1)
    ip_address: Optional[str] = None
    user_agent: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Pagination:
    total: int = 0
    pages: int = 0
    offset: int = 0
    limit: int = 0
    current_page: int = 0


AuditLog = TypeVar('AuditLog')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PageResponse(Generic[AuditLog], IResponseRequest):
    code: int = 0
    message: Optional[str] = None
    data: Optional[List[AuditLog]] = None
    pagination: Optional[Pagination] = None

Python SearchProcurementItemRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /procurement/item/search HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	code: 0,
	message: String,
	data: 
	[
		{
			id: 0,
			batchId: 0,
			departmentId: 0,
			equipmentId: 0,
			productName: String,
			technicalSpec: String,
			unit: String,
			quantity: 0,
			purpose: String,
			note: String,
			approvalStatus: 0,
			approvalNote: String,
			approvedAt: "0001-01-01T00:00:00.0000000+07:06",
			approvedBy: 0,
			createdAt: "0001-01-01T00:00:00.0000000+07:06",
			createdBy: 0,
			updatedAt: "0001-01-01T00:00:00.0000000+07:06",
			updatedBy: 0,
			isDeleted: False,
			deletedAt: "0001-01-01T00:00:00.0000000+07:06",
			deletedBy: 0,
			departmentName: String,
			createdByName: String,
			approvedByName: String
		}
	]
}