tvpl.api

<back to all web services

ReportSearch

Requires Authentication
The following routes are available for this service:
POST/report/search
import Foundation
import ServiceStack

public class ReportSearch : PagingRequest
{
    public var columns:[String] = []
    public var title:String
    public var typeId:Int?
    public var groupId:Int?
    public var subjectId:Int?
    public var isUrgent:Bool?
    public var documentSearchStage:DocumentSearchStage
    public var isInternal:Bool?
    public var fromDate:Date?
    public var toDate:Date?
    public var statusId:Int?
    public var issuingAgencyId:Int?
    public var orderBy:SearchOrderBy
    public var isParty:Bool?
    public var branchType:Int16?
    public var effectBeginDateFrom:Date?
    public var effectBeginDateTo:Date?
    public var effectEndDateFrom:Date?
    public var effectEndDateTo:Date?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case columns
        case title
        case typeId
        case groupId
        case subjectId
        case isUrgent
        case documentSearchStage
        case isInternal
        case fromDate
        case toDate
        case statusId
        case issuingAgencyId
        case orderBy
        case isParty
        case branchType
        case effectBeginDateFrom
        case effectBeginDateTo
        case effectEndDateFrom
        case effectEndDateTo
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        columns = try container.decodeIfPresent([String].self, forKey: .columns) ?? []
        title = try container.decodeIfPresent(String.self, forKey: .title)
        typeId = try container.decodeIfPresent(Int.self, forKey: .typeId)
        groupId = try container.decodeIfPresent(Int.self, forKey: .groupId)
        subjectId = try container.decodeIfPresent(Int.self, forKey: .subjectId)
        isUrgent = try container.decodeIfPresent(Bool.self, forKey: .isUrgent)
        documentSearchStage = try container.decodeIfPresent(DocumentSearchStage.self, forKey: .documentSearchStage)
        isInternal = try container.decodeIfPresent(Bool.self, forKey: .isInternal)
        fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate)
        toDate = try container.decodeIfPresent(Date.self, forKey: .toDate)
        statusId = try container.decodeIfPresent(Int.self, forKey: .statusId)
        issuingAgencyId = try container.decodeIfPresent(Int.self, forKey: .issuingAgencyId)
        orderBy = try container.decodeIfPresent(SearchOrderBy.self, forKey: .orderBy)
        isParty = try container.decodeIfPresent(Bool.self, forKey: .isParty)
        branchType = try container.decodeIfPresent(Int16.self, forKey: .branchType)
        effectBeginDateFrom = try container.decodeIfPresent(Date.self, forKey: .effectBeginDateFrom)
        effectBeginDateTo = try container.decodeIfPresent(Date.self, forKey: .effectBeginDateTo)
        effectEndDateFrom = try container.decodeIfPresent(Date.self, forKey: .effectEndDateFrom)
        effectEndDateTo = try container.decodeIfPresent(Date.self, forKey: .effectEndDateTo)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if columns.count > 0 { try container.encode(columns, forKey: .columns) }
        if title != nil { try container.encode(title, forKey: .title) }
        if typeId != nil { try container.encode(typeId, forKey: .typeId) }
        if groupId != nil { try container.encode(groupId, forKey: .groupId) }
        if subjectId != nil { try container.encode(subjectId, forKey: .subjectId) }
        if isUrgent != nil { try container.encode(isUrgent, forKey: .isUrgent) }
        if documentSearchStage != nil { try container.encode(documentSearchStage, forKey: .documentSearchStage) }
        if isInternal != nil { try container.encode(isInternal, forKey: .isInternal) }
        if fromDate != nil { try container.encode(fromDate, forKey: .fromDate) }
        if toDate != nil { try container.encode(toDate, forKey: .toDate) }
        if statusId != nil { try container.encode(statusId, forKey: .statusId) }
        if issuingAgencyId != nil { try container.encode(issuingAgencyId, forKey: .issuingAgencyId) }
        if orderBy != nil { try container.encode(orderBy, forKey: .orderBy) }
        if isParty != nil { try container.encode(isParty, forKey: .isParty) }
        if branchType != nil { try container.encode(branchType, forKey: .branchType) }
        if effectBeginDateFrom != nil { try container.encode(effectBeginDateFrom, forKey: .effectBeginDateFrom) }
        if effectBeginDateTo != nil { try container.encode(effectBeginDateTo, forKey: .effectBeginDateTo) }
        if effectEndDateFrom != nil { try container.encode(effectEndDateFrom, forKey: .effectEndDateFrom) }
        if effectEndDateTo != nil { try container.encode(effectEndDateTo, forKey: .effectEndDateTo) }
    }
}

public class PagingRequest : Codable
{
    public var page:Int
    public var limit:Int

    required public init(){}
}

public enum DocumentSearchStage : String, Codable
{
    case All
    case AllProcessing
    case Draft
    case PendingApproval
    case IsRevisionRequested
    case PendingCompilation
    case PendingReport
    case Published
    case Active
    case InActive
}

public enum SearchOrderBy : String, Codable
{
    case UpdatedDateDesc
    case PublishDateDesc
    case TitleAsc
    case DocumentCodeAsc
}

public class SearchResponse : IResponseRequest, Codable
{
    public var totalCount:Int
    public var code:Int
    public var data:[DocumentSearchResultItem] = []
    public var message:String

    required public init(){}
}

public class DocumentSearchResultItem : Codable
{
    public var title:String
    public var Description:String
    public var owner:String
    public var documentPolicyId:Int?
    public var updateDocumentId:Int?
    public var effectBeginDate:Date?
    public var effectEndDate:Date?
    public var issuingAgencyId:Int?
    public var signBy:String
    public var signDate:Date?
    public var updatedAt:Date?
    public var statusId:Int?
    public var statusKey:String
    public var isInternal:Bool
    public var documentNumber:String
    public var documentCode:String
    public var isUrgent:Bool?
    public var id:Int
    public var reasonReturn:String
    public var accountId:Int?
    public var approverId:Int?
    // @StringLength(500)
    public var updatedBy:String

    // @StringLength(500)
    public var createdBy:String

    public var isParty:Bool?
    public var branchType:Int16
    public var isRevisionRequested:Bool?
    public var isPrivate:Bool?
    public var departmentId:Int?
    public var publicationDate:Date?
    public var processStatusId:Int
    public var documentTypeId:Int?
    public var documentGroupId:Int?
    public var accountName:String
    public var acceptAccountName:String
    public var documentGroupText:String
    public var processStatusText:String
    public var documentTypeText:String
    public var departmentText:String
    public var statusText:String
    public var issuingAgencyText:String
    public var comment:String
    public var submitComment:String
    public var fullFile:String
    public var parthFile:String
    public var isActive:Bool?
    public var stepOrder:Int?
    public var stepCount:Int?
    public var completedStepCount:Int?

    required public init(){}
}


Swift ReportSearch DTOs

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

HTTP + CSV

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

POST /report/search HTTP/1.1 
Host: qlcn-api.vsmlab.vn 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"columns":["String"],"title":"String","typeId":0,"groupId":0,"subjectId":0,"isUrgent":false,"documentSearchStage":"All","isInternal":false,"fromDate":"0001-01-01T00:00:00.0000000+07:06","toDate":"0001-01-01T00:00:00.0000000+07:06","statusId":0,"issuingAgencyId":0,"orderBy":"UpdatedDateDesc","isParty":false,"branchType":0,"effectBeginDateFrom":"0001-01-01T00:00:00.0000000+07:06","effectBeginDateTo":"0001-01-01T00:00:00.0000000+07:06","effectEndDateFrom":"0001-01-01T00:00:00.0000000+07:06","effectEndDateTo":"0001-01-01T00:00:00.0000000+07:06","page":1,"limit":10}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"totalCount":0,"code":0,"data":[{"title":"String","description":"String","owner":"String","documentPolicyId":0,"updateDocumentId":0,"effectBeginDate":"0001-01-01T00:00:00.0000000+07:06","effectEndDate":"0001-01-01T00:00:00.0000000+07:06","issuingAgencyId":0,"signBy":"String","signDate":"0001-01-01T00:00:00.0000000+07:06","updatedAt":"0001-01-01T00:00:00.0000000+07:06","statusId":0,"statusKey":"String","isInternal":false,"documentNumber":"String","documentCode":"String","isUrgent":false,"id":0,"reasonReturn":"String","accountId":0,"approverId":0,"updatedBy":"String","createdBy":"String","isParty":false,"branchType":0,"isRevisionRequested":false,"isPrivate":false,"departmentId":0,"publicationDate":"0001-01-01T00:00:00.0000000+07:06","processStatusId":0,"documentTypeId":0,"documentGroupId":0,"accountName":"String","acceptAccountName":"String","documentGroupText":"String","processStatusText":"String","documentTypeText":"String","departmentText":"String","statusText":"String","issuingAgencyText":"String","comment":"String","submitComment":"String","fullFile":"String","parthFile":"String","isActive":false,"stepOrder":0,"stepCount":0,"completedStepCount":0}],"message":"String"}