---
# System prepended metadata

title: TaskCenter x PJM2

---

# TaskCenter x PJM2

# ApiDoc

## Login Page
| API |
| ------------- |
| Check has server |
| Login |
| Get company list |

### Check has server api

 > API สำหรับเช็ค URL server

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/CheckServerHostUrl |


**Request Body**
    
    {
        serverUrl: string
    }
**Request Body Example**
    
    {
        serverUrl: prototype-taskcenter.on.lk
    }
**Response**

    {
        isPojjamanServer: boolean,
        serverStatus: string,
        companyGuid: string,
        pjmVersion: string
    }
**Response Example**
    
    {
        isPojjamanServer: true,
        serverStatus: "OK",
        companyGuid: "13FEA752-D3A2-453D-B458-0E17DBFE98D5",
        pjmVersion: "2.83.40-f4c12ac! MS-36695_PJM-TaskCenter 2025-05-27 17:35"
    }
    
### Login

> API สำหรับ login

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | POST |
| URL | /Api/TaskCenter/AuthenticationUser |

**Request Body**

    {
        username: string,
        password: string,
        companyGuid: string
    }
    
**Request Body Example**

    {
        username: "taskcenter",
        password: "P@ssword",
        companyGuid: "13FEA752-D3A2-453D-B458-0E17DBFE98D5"
    }

**Response**

    {
        isSuccess: boolean,
        userDetail: {
                        userId: int,
                        userGuid: string,
                        userCode: string,
                        userName: string,
                        userFullName: string,
                        userEmail: string,
                        enTicket: string,
                    }
    }
    
**Response Example**
    
    {
        isSucess: true,
        userDetail: {
                        userId: 74,
                        userGuid: "13FEA752-D3A2-453D-B458-0E17DBFE98D5",
                        userCode: "taskcenter001",
                        userName: "taskcenter",
                        userFullName: "task center" ,
                        userEmail: "test@taskcenter.builk",
                        enTicket: EiKf9vBVMW0Qiu6EWgzwU7PyCdD0BLxv7ks4kTe4fXvGP...,
                    }
    }

### Get company list

> API สำหรับดึงรายการบริษัทที่ user อยู่

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/GetCompanyList |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![Screenshot 2024-12-19 135253](https://hackmd.io/_uploads/rJKAfrZSJl.png)

**Request Header**

    {
        Key: "Auth",
        Value: enTicket
    }
**Request Header Example**

    {
        Key: "Auth",
        Value: "7ECDD1B2A8C8685578D10832114FF..."
    }
**Query Params**
    
    { no query params }

**Response**

    {
        companyList: {
            id: string | number,
            imageUrl: string,
            companyName: string,
            companyGuid: string
        }[]
    }

**Response Example**

    {
        companyList: [
            {
                id: 1,
                imageUrl: "https://imageLink.url/1",
                companyName: "Company 1",
                companyGuid: "685ac355-e0f9-4df1-8e1d-78f6a65e037e"
            },
            {
                id: 2,
                imageUrl: "https://imageLink.url/2",
                companyName: "Company 2",
                companyGuid: "482e6b4d-b158-446a-939e-d8908398a04c"
            },
            {
                id: 3,
                imageUrl: "https://imageLink.url/3",
                companyName: "Company 3",
                companyGuid: "47bf02e8-7a1b-4773-920c-576d81fe9d6d"
            }
        ]
    }

## Home page

| API |
| ------------- |
| Get announcement list|
| Get notification count |
| Get approve count |
| Get aprrove count group |
| Get wait approve list |

### Get announcement list

> API สำหรับดึงรายการที่บริษัทต้องการประกาศ ***ยังไม่มีใน pjm

![Screenshot 2024-12-19 135221](https://hackmd.io/_uploads/ry83zSWHkl.png)

**Request Body**

    {
        companyId: string | number
    }

**Response**
    
    {
        annoucementList: {
            announcementId: string | number,
            subject: string,
            imageUrl: string
        }[]
    }
    
**Response Example**

    {
        announcementList: [
            {
                announcementId: 1,
                subject: "Everyone please watch",
                imageUrl: https://imageLink.url/1
            },
            {
                announcementId: 2,
                subject: "This one is important",
                imageUrl: https://imageLink.url/2
            },
            {
                announcementId: 3,
                subject: "This one is important too",
                imageUrl: https://imageLink.url/3
            }
        ]
    }
    
### Get notification count

> API สำหรับขอจำนวน notification

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/GetNotificationCount |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![Screenshot 2024-12-19 135154](https://hackmd.io/_uploads/HkIczSZB1g.png)

**Request Header**

    {
        Key: "Auth",
        Value: enTicket
    }
**Request Header Example**

    {
        Key: "Auth",
        Value: "7ECDD1B2A8C8685578D10832114FF..."
    }

**Query Params**

    {
        companyId: int
        userId: int
    }
**Query Params Example**

    {
        companyId: 1
        userId: 99
    }
        
**Response**

    {
        notificationCount: int
    }
    
**Response Example**
    
    {
        notificationCount: 100
    }
    
### Get approve count

> API สำหรับดึงจำนวนเอกสารที่รอ approve ทั้งหมด

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/GetApproveCount |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![Screenshot 2024-12-19 135408](https://hackmd.io/_uploads/rybFXSWrkl.png)

**Request Header**

    {
        Key: "Auth",
        Value: enTicket
    }
**Request Header Example**

    {
        Key: "Auth",
        Value: "7ECDD1B2A8C8685578D10832114FF..."
    }
**Query Params**

    {
        companyId: int
        userId: int
    }
**Query Params Example**

    {
        companyId: 1
        userId: 99
    }
**Response**
    
    {
        waitingCount: int,
        overdueCount: int
    }

**Response Example**

    {
        waitingCount: 35,
        overdueCount: 10
    }

### Get aprrove count group

> API สำหรับดึงจำนวนเอกสารที่รอ approve โดยแบ่งตาม module

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/GetApproveCountGroup |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![image (1)](https://hackmd.io/_uploads/Hk4pXrZHkl.png)


**Request Header**

    {
        Key: "Auth",
        Value: enTicket
    }
**Request Header Example**

    {
        Key: "Auth",
        Value: "7ECDD1B2A8C8685578D10832114FF..."
    }
**Request Body**

    {  
        companyId: int,
        docTypeIdList: doctypeenum[],
        dateStartAt: datetime,
        dateEndAt: datetime,
        projectId: int,
        dueDate: string,
        skip: int,
        take: int,
        orderBy: string,
        isDesc: bool,
        text: string,
        stakeholderType: string,
        stakeholderId: int
    }  
**Request Body Example**

    {
        companyId: 1,
        docTypeIdList: [22,24,37,43],
        dateStartAt: "2025-05-01 00:00:00.000",
        dateEndAt: "2025-05-31 00:00:00.000",
        projectId: 0,
        dueDate: "all", //overdue, ondue
        skip: 0,
        take: 20,
        orderBy: "project", //"project", "stakeholder"
        isDesc: true,
        text: "xxx,
        stakeholderType: "supplier", //"supplier", "customer", "employee"
        stakeholderId: 2
    } 
**Response**
    
    {
        groupCount: {
            groupName: string,
            approveCount: int
        }[]
    }
    
**Response Example**
    
    {
        groupCount: [
            {
                groupName: "Project",
                approveCount: 20
            },
            {
                groupName: "Sale",
                approveCount: 5
            },
            {
                groupName: "Timesheet",
                approveCount: 45
            }
        ]
    }
    
### Get wait approve list

> API สำหรับดึงรายการเอกสารที่ request approve ล่าสุด (5 รายการแรก)

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | POST |
| URL | /Api/TaskCenter/GetDocumentList |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![image](https://hackmd.io/_uploads/S1PZ4BbHJx.png)


**Request Header**

    {
        Key: "Auth",
        Value: enTicket
    }
**Request Header Example**

    {
        Key: "Auth",
        Value: "7ECDD1B2A8C8685578D10832114FF..."
    }
**Request Body**

    {
        companyId: int,
        doctypeIdList: doctypeenum[],
        dateStartAt: datetime,
        dateEndAt: datetime,
        orgId: int,
        dueDate: string,
        skip: int,
        take: int,
        orderBy: string,
        isDesc: bool,
        text: string,
        stakeholderType: string,
        stakeholderId: int
    }
**Request Body Example**

    {
        companyId: 4,
        doctypeIdList: [],
        dateStartAt: "2025-05-01 00:00:00.000",
        dateEndAt: "2025-05-31 00:00:00.000",
        orgId: 0,
        dueDate: "all",
        skip: 0,
        take: 5,
        orderBy: null,
        isDesc: 1,
        text: null,
        stakeholderType: "null",
        stakeholderId: 0
    }
**Response**

    {
        totalCount: int,
        documentList: [
                            {
                                docId: int,
                                docCode: string,
                                docTypeId: doctypeenum,
                                docTypeName: string,
                                docAmount: number,
                                docDate: datetime,
                                docGuid: string,
                                projectName: string,
                                orgId: int,
                                orgName: string,
                                extOrgId: int,
                                extOrgName: string,
                                employeeId: int,
                                employeeName: string,
                                currency: string,
                                progress: string,
                                checkBudget: bool,
                                warningBudget: bool,
                                dueDate: datetime,
                                createTimeStamp: datetime,
                                diffDate: int,
                                docStatus: docstatus,
                                customDocMetaName: string,
                                completeBy: string"
                            }
                        ]
    }
    
**Response Example**

    {
        "totalCount": 2,
        "documentList": [
                            {
                                "docId": 3018,
                                "docCode": "POMAT2505-0114",
                                "docTypeId": 22,
                                "docTypeName": "PO",
                                "docAmount": 1.070000,
                                "docDate": "2025-05-28T00:00:00",
                                "docGuid": "3794ba46-013c-459b-ab18-165fcb05e6b2",
                                "projectName": null,
                                "orgId": 4,
                                "orgName": "บริษัท บิลค์ วัน กรุ๊ป จำกัด",
                                "extOrgId": 3,
                                "extOrgName": "บริษัท เอ็น. ซี. ซี. แมนเนจเม้นท์ แอนด์ ดิเวลลอปเม้นท์ จำกัด",
                                "employeeId": 0,
                                "employeeName": null,
                                "currency": "THB",
                                "progress": "TC01||TC02",
                                "checkBudget": false,
                                "warningBudget": false,
                                "dueDate": "2025-05-28T00:00:00",
                                "createTimeStamp": "2025-05-28T12:01:30.067",
                                "diffDate": 5,
                                "docStatus": null,
                                "customDocMetaName": null,
                                "completeBy": "QA-PJM-01"
                            },
                            {
                                "docId": 3006,
                                "docCode": "POMAT2505-0105",
                                "docTypeId": 22,
                                "docTypeName": "PO",
                                "docAmount": 1070.000000,
                                "docDate": "2025-05-26T00:00:00",
                                "docGuid": "84c3ebf5-a35e-4915-b930-45606e3615dd",
                                "projectName": null,
                                "orgId": 522,
                                "orgName": "ตึกเกาลัด - TestAllocate",
                                "extOrgId": 3,
                                "extOrgName": "บริษัท เอ็น. ซี. ซี. แมนเนจเม้นท์ แอนด์ ดิเวลลอปเม้นท์ จำกัด",
                                "employeeId": 0,
                                "employeeName": null,
                                "currency": "THB",
                                "progress": "TC01||TC02",
                                "checkBudget": false,
                                "warningBudget": false,
                                "dueDate": "2025-05-26T00:00:00",
                                "createTimeStamp": "2025-05-26T12:45:22.787",
                                "diffDate": 7,
                                "docStatus": null,
                                "customDocMetaName": null,
                                "completeBy": "QA-PJM-01"
                            }
                        ]
    }
    
## Setting page

| API |
| ------------- |
| Get user detail|
| Update user detail|
| Update user image |
| Get signature |
| Update signature |
| Delete signature |

### Get user detail

> API สำหรับดึงข้อมูลของ user

| ENDPOINT | DETAIL |
| ------------- | ------------- |
| METHOD | GET |
| URL | /Api/TaskCenter/GetUserDetail |
| HEADER | Key : Auth, Value : 7ECDD1B2A8C8685578D10832114FF... |

![image](https://hackmd.io/_uploads/Sk0rEHbSyl.png)

**Request Body**

    {
        userId: int
    }

**Response**

    {
        userId: number,
        userGuid: string,
        userImage: string,
        namee: string
        email: string
    }
    
**Response Example**

    {
        userId: 1,
        userGuid: "b374b05d-2b2a-40d8-8039-562bf3233ef0"
        userImage: https://image.url/1,
        name: "test tester"
        email: "test@mail.com"
    }
    
### Update user detail

> API สำหรับแก้ไขข้อมูลของ user

![image](https://hackmd.io/_uploads/BJy9ErZH1g.png)

**Request Body**

    {
      userId: number | string,
      companyId: number | string,
      firstname: string,
      lastname: string,
      email: string
    }
    
**Request Example**

    {
        userId: 1,
        companyId: 122,
        firstname: "Newname",
        lastname: "Newlastname",
        email: "test2@mail.com"
    }
    
**Response**

    {}

### Update user image

> API สำหรับอัปโหลดรูปภาพโปรไฟล์ใหม่ของ user

![image](https://hackmd.io/_uploads/BJx2NB-SJx.png)

**Request Body**

    form-data
    {
        userGuid: number | string,
        file: file     
    }
    
**Request Example**

    {
        userGuid: "b374b05d-2b2a-40d8-8039-562bf3233ef0",
        file: fileType
    }
    
**Response**

    {
        status: 200,
        message: "SUCCESS"
    }
    
### Get signature

> API สำหรับขอรูปภาพลายเซ็น

![image](https://hackmd.io/_uploads/SJX0Er-SJx.png)

**Request Body**

    {
        userId: number | string,
        companyId: number | string
    }

**Response**

    {
        signatureImageUrl: image file
    }
    
**Response Example**

    {
        signatureImageUrl: byte array // chang to blob file
    }
    
### Update signature

> API สำหรับเพิ่ม/แก้ไขลายเซ็น

![image](https://hackmd.io/_uploads/Hk--rHWHyx.png)

**Request Body**
    
    {
        userId: number | string,
        signatureImageUrl: string
    }
    
**Request Example**

    {
        userId: 1,
        signatureImageUrl: https://newSigUrl.link/1
    }
    
### Delete signature

> API สำหรับลบลายเซ็น Method Delete

**Body**

    {
        userGuid: string
    }
    
**Example**

    {
        userGuid: "b374b05d-2b2a-40d8-8039-562bf3233ef0"
    }
    
## Document list page

| API |
| ------------- |
| Get document list|
| Update status document|


### Get document list

> API สำหรับดึงรายการเอกสารที่รอ approve ทั้งหมด

![image](https://hackmd.io/_uploads/rkNyYH-ryx.png)
![image](https://hackmd.io/_uploads/ryxltrWSyg.png)

**Request Body**

    {
        userId: number | string,
        companyId: number | string,
        group: string[],//ไม่ต้องมีก็ได้เพราะไปกรุ๊ปที่ตัวแอพได้
        docTypeIdList: Enum[], // เปลี่ยนเป็น list Enum
        dateStartAt?: DateTime,
        dateEndAt?: DateTime,
        orgId?: int, เปลี่ยนเป็น orgId แทน
        DueDate: string//ยังไม่รู้คือวันที่อะไร
    }
    
**Request Example**

    {
        userId: 1,
        companyId: 122,
        group: ["Project", "Sale", "Account"],
        docTypeIdList: [22,37,43],
        dateStartAt: "2024-06-15T00:00:00.0000000Z",
        dateEndAt: "2024-06-16T00:00:00.0000000Z",
        orgId: 1,
        DueDate: "All"
    }

**Request Example 2**

    {
        userId: 1,
        companyId: 122,
        group: ["Project", "Sale", "Account"],
        docTypeIdList: "Timesheet",
        dateStartAt: "2024-06-15T00:00:00.0000000Z",
        dateEndAt: "2024-06-16T00:00:00.0000000Z",
        orgId: 1,
        DueDate: "Overdue"
    }

**Response**
    
    {
        totalCount: number, 
        documentList: {
            docLineOfApproveId: string
            docId: int
            docCode: string 
            docTypeId: DocTypeEnum 
            docTypeName: string 
            docAmount: decimal?
            docDate: DateTime? 
            docGuid: string
            orgId: int 
            orgCode: string 
            orgName: string 
            extOrgId: int 
            extOrgCode: string 
            extOrgName: string 
            lineOfApproveState: string 
            currency: string 
            progress: string 
            checkBudget: bool? 
            warningBudget: bool? 
            dueDate: DateTime? 
            createTimeStamp: DateTime? 
            docAllocationRequire: bool? 
            completeBy: string 
            remainingDays: int? 
            diffDate: int? 
            elaspeDays: int? 
            nextstate: string 
            lineOfApprovetoState: string 
            docStatus: DocStatus? 
            }[]
    }
    
**Example**

    {
        totalCount: 100,
        groupBy: "Project",
        documentList: [
            {
                documentId: "Doc-ID-xxxxxx", 
                name: "Innovatech",
                sendDate: 11/12/24, 
                amount: 28000, 
                documentType: "Cost Allocation",
                DocLineOfApproveId: "423e9320-3a19-4cec-8216-b21a04fc9a31",
                DocId: 3462,
                DocCode: "WE2567-02-0002",
                DocTypeId: 97,
                DocTypeName: "WorkerExpense",
                DocAmount: 10712.000000,
                DocDate: "2024-02-19T00:00:00",
                DocGuid: "cc619b68-b072-4217-b9c4-681b589f55c0",
                OrgId: 176,
                OrgCode: "6405",
                OrgName: "BankTest",
                LineOfApproveState: "Start",
                Currency: "THB",
                Progress: "@Bank",
                CheckBudget: false,
                WarningBudget: false,
                DueDate: "2024-02-19T00:00:00",
                CreateTimeStamp: "2024-02-19T12:47:19.77",
                DocAllocationRequire: true,
                CompleteBy: "lucifer",
                RemainingDays: -336,
                DiffDate: 336,
                ElaspeDays: -337,
                nextstate: "Done",
                LineOfApprovetoState: "Done",
                DocStatus: null
            }
        ]
    }
    
### Update status document

> API สำหรับอัพเดทสถานะ (approve/reject) ของเอกสาร

![image](https://hackmd.io/_uploads/HJCa_SWrkx.png)
![image](https://hackmd.io/_uploads/rkZauHWr1g.png)

**Request Body**
    
    {
        documents: {
            docId: int,
            docCode: string,
            docGuid: string,
            docTypeId: DoctypeEnum,
            docDate: Datetime,
            orgId: int,
            note?: string,
            comfirm: bool
        }[],
        isApprove: boolean
    }

**Response Body**
    
    {
        docId: int,
        docTypeId: DoctypeEnum,
        isSuccess: bool,
        message: {
            messageType: MessageType,
            messageTH: string,
            messageENG: string,
            isApprove: bool
        }
    }[]
    

## Document detail page

| API |
| ------------- |
| Get document detail |
| Get attach file list |
| Get allocate detail |
| Send email |
| Download attach file |
| Get Customnote |

### Get document detail

> API สำหรับดึงรายละเอียดของเอกสาร

![image](https://hackmd.io/_uploads/ryFNuHZSyl.png)

**Request Body**
    
    {
        doId: int,
        docGuiId: string,
        doctypeId: DocTypeEnum
    }

**Response**
    
    documentDetail: {
        docLineOfApproveId: string,
        docId: int,
        docCode: string,
        docGuId: string,
        docTypeId: DocTypeEnum,
        docTypeName: string,
        docDate: DateTime,
        orgId: int,
        orgCode: string,
        orgName: string,
        lineOfApproveState: string,
        condition: string,
        docAmount: decimal,
        completeBy: string,
        docCreateBy: string,
        createTimestamp: DateTime,
        lineOfApproveNextState: string,
        extOrgId: int,
        extOrgCode: string,
        extOrgName: string,
        taxBase: decimal,
        taxRate: decimal,
        taxAmount: decimal,
        beforeTax: decimal,
        currency: string,
        currencyRate: decimal,
        docRemarks: string,
        approveSignalTo: string,
        token: string,
        docCreateTimestamp: DateTime
    },
    activities: [
        {
            activityDateTime: DateTime,
            userAvatarLink: string,
            actionStatus: string,
            "username": string,
            "comment": string,
            "docLineApproveGuid": string
        }
    ],
    loaList: [
        {
            activityDateTime: DateTime,
            userAvatarLink: string,
            actionStatus: string,
            username: string,
            comment: string,
            docLineApproveGuid: string
        }
    ],
    currentActivities: {
        activityDateTime: DateTime,
        userAvatarLink: string,
        actionStatus: string,
        username: string,
        comment: string,
        docLineApproveGuid: string
    }
    
**Example**
    
    "documentDetail": {
        "docLineOfApproveId": "d70212ef-8868-43f1-a6df-ebb59f8c6d8d",
        "docId": 3462,
        "docCode": "WE2567-02-0002",
        "docGuId": "cc619b68-b072-4217-b9c4-681b589f55c0",
        "docTypeId": 97,
        "docTypeName": "WorkerExpense",
        "docDate": "2024-02-19T00:00:00",
        "orgId": 176,
        "orgCode": "6405",
        "orgName": "BankTest",
        "lineOfApproveState": "Start",
        "condition": "true",
        "docAmount": 10712.000000,
        "completeBy": "Bank",
        "docCreateBy": "lucifer",
        "createTimestamp": "2025-01-23T14:33:21.967",
        "lineOfApproveNextState": null,
        "extOrgId": null,
        "extOrgCode": null,
        "extOrgName": null,
        "taxBase": null,
        "taxRate": null,
        "taxAmount": null,
        "beforeTax": 10712.000000,
        "currency": "THB",
        "currencyRate": 1.000000000000,
        "docRemarks": null,
        "approveSignalTo": null,
        "token": "EAAAANaZ9ChvI0n9iWwtD/BYmWqlw9q4b61+SzreD8PjyE5UsXc4Tyy59wgzsAeFOtt3Aw==",
        "docCreateTimestamp": "2024-02-19T12:46:05"
    },
    "activities": [
        {
            "activityDateTime": "2025-01-23T07:33:13.477Z",
            "userAvatarLink": "79d092cb-de76-46cd-a51b-4fc842c968ab",
            "actionStatus": "Edit",
            "username": "Bank",
            "comment": "Edit",
            "docLineApproveGuid": null
        },
        {
            "activityDateTime": "2025-01-21T11:13:12.587Z",
            "userAvatarLink": "79d092cb-de76-46cd-a51b-4fc842c968ab",
            "actionStatus": "Complete",
            "username": "Bank",
            "comment": "Complete",
            "docLineApproveGuid": null
        },
        {
            "activityDateTime": "2025-01-21T11:13:08.533Z",
            "userAvatarLink": "79d092cb-de76-46cd-a51b-4fc842c968ab",
            "actionStatus": "Reject",
            "username": "Bank",
            "comment": "",
            "docLineApproveGuid": null
        },
        {
            "activityDateTime": "2025-01-21T11:01:04.526Z",
            "userAvatarLink": "79d092cb-de76-46cd-a51b-4fc842c968ab",
            "actionStatus": "Approved",
            "username": "Bank",
            "comment": "",
            "docLineApproveGuid": "b51a7d0b-f783-407d-8d73-de06cfc8a4f7"
        }
    ],
    "loaList": [
        {
            "activityDateTime": "2026-01-23T17:57:57.603",
            "userAvatarLink": "88888888-4444-4444-4444-13b7b30456a1",
            "actionStatus": "Start",
            "username": "@Bank||MD",
            "comment": "[...]",
            "docLineApproveGuid": null
        },
        {
            "activityDateTime": "2026-01-23T17:57:57.603",
            "userAvatarLink": "88888888-4444-4444-4444-13b7b30456a1",
            "actionStatus": "L1",
            "username": "@Bank||MD",
            "comment": "[...]",
            "docLineApproveGuid": null
        }
    ],
    "currentActivities": {
        "activityDateTime": "2025-01-23T17:57:57.1948374+07:00",
        "userAvatarLink": "79d092cb-de76-46cd-a51b-4fc842c968ab",
        "actionStatus": "0",
        "username": "Bank",
        "comment": "[...]",
        "docLineApproveGuid": null
    }
    
### Get attach file list

> API สำหรับดึงรายการไฟล์แนบของเอกสาร

![image](https://hackmd.io/_uploads/HkBz_SWrJe.png)

**Request Body**
    
    {
        docGuid: string,
        docTypeId : DocTypeEnum,
        uploadType: string // "fileattachment", "customnote"
    }

**Response**
    
    {
        fileList: {
            fileUrl: string,
            fileName: string
        }[]
    }

### Get allocate detail

> API สำหรับดึงข้อมูลจัดสรรของเอกสาร

![image](https://hackmd.io/_uploads/H1axdrZHkl.png)

**Request Body**

    {
        documentId: number | string
    }

**Response**

    {
        orgId: int,
        orgCode: string,
        orgDesc: string,
        code: string,
        name: string,
        description: string,
        docTypeId: DoctypeEnum,
        docId: int,
        docActualAmount: decimal,
        budgetAmount: decimal,
        percentTheshold: decimal,
        budgetControlAmount: decimaldecimal,
        budgetRemainAmount: decimal,
        budgetControlRemainAmount: decimal,
        budgetRemainApproveAmount: decimal,
        budgetRemainApproveQty: decimal,
        hasDocLOA: bool,
        budgetControlType: ControlBudgetType,
        isNotControl: bool
    }
    
**Example**

        [
            {
                "orgId": 379,
                "orgCode": "CGE2023/019",
                "orgDesc": "CGE2023/019 : ททท.-Amazing Northern Life",
                "code": "a-001",
                "name": "Exhibition & Event",
                "description": "Exhibition & Event",
                "docTypeId": 22,
                "docId": 2768,
                "docActualAmount": 934.580000,
                "budgetAmount": 10000.000000,
                "percentTheshold": null,
                "budgetControlAmount": 10000.000000,
                "budgetRemainAmount": 8065.420000,
                "budgetControlRemainAmount": 8065.420000,
                "budgetRemainApproveAmount": 9065.420000,
                "budgetRemainApproveQty": 0.0000000000000,
                "hasDocLOA": true,
                "budgetControlType": 4,
                "isNotControl": false
            }
        ]

### Get Customnote

> API สำหรับดึงรายการ customnote ของเอกสาร

**Request Body**
    
    {
        docGuid: string,
    }

**Response**
    
    {
        {
            KeyName: string,
            KeyNameTH: string,
            DataType: string,
            Values: string[]
        }[]
    }

**Example**
       
    {
        {
            KeyName: "A.Project",
            KeyNameTH: "โปรเจค/งานที่ขายสินค้า",
            DataType: "System.String",
            Values: [
                "CGE2023/019 : ททท.-Amazing Northern Life"
            ]
        }
    }
    
### Send email

> API สำหรับส่งอีเมลไฟล์เอกสารที่ได้รับการ approve

![image](https://hackmd.io/_uploads/SyHk_rbH1x.png)
 
**Request Body**

    {
        documentId: number | string
        sendTo: string,
        form: string
    }
    
**Response Body**

    {}
 
### Download attach file

> API สำหรับ downlaod ไฟล์แนบ

![image](https://hackmd.io/_uploads/Hy-0PHZSye.png)

**Request Body**

    {   
    docId: int,
    docCode: string,
    docGuid: string,
    docTypeId: DocTypeEnum,
    subDocTypeId: int,
    docCurrency": string,
    docCurrencyRate: decimal,
    docStatus: DocStatus,
    docOrgId: int,
    formName: string,
    companyId: int
    }

**Response**
    
    {
        File Blob { type: 'application/pdf' });
    }
    
## History page

| API |
| ------------- |
| Get history count |

### Get history count

> API สำหรับดึงจำนวนเอกสารที่ถูก approve/reject ไปแล้ว

![image](https://hackmd.io/_uploads/rJv3DBbrJg.png)

**Request Body**
    
    {
        userId: number | string,
        companyId: number | string
    }

**Response**

    {
        totalApproveCount: number,
        totalRejectCount: number
    }
    
## Notification

| API |
| ------------- |
| Get notification list |

### Get notification list

> API สำหรับดึงรายการ notification

![image](https://hackmd.io/_uploads/ByY9vrZr1l.png)

**Request Body**
    
    {
        userId: number | string,
        companyId: number | string
    }

**Response**
    
    {
        notificationList: {
                guid: string,
                docId: int,
                "docCode": string,
                "docTypeId": int,
                "docTypeName": string,
                "docGuid": string,
                "docDate": DateTime,
                "docOrgId": int,
                "docOrgCode": string,
                "docOrgName": string,
                "docStatus": DocstatusEnum,
                "taskType": TaskTypeEnum,
                "taskTypeName": string,
                "message": string,
                "taskTimeStamp": DateTime?,
                "taskBy": string,
                "dueDate": DateTime?,
                "toDocTypeId": DocTypeEnum,
                "toDocTypeName": string,
                "refSettingId": string,
                "createAction": TaskActionEnum,
                "createActionName": string,
                "requireAction": TaskActionEnum,
                "requireActionName": string,
                "userAvatar": string,
                "isDone": bool?,
                "checkpoint": bool?,
                "isArchive": bool?,
                "isView": bool?,
                "accessAble": bool?,
                "workerName": string,
                "docAmount": decimal,
                "subDocTypeId": int,
                "subDocTypeName": string,
                "currency": string
        }[]
        
**Example**

    {
        "notificationList": [
            {
                "guid": "23117e04-5a18-45ba-9d8e-15221b84fca5",
                "docId": 2768,
                "docCode": "Doctype2501-0002",
                "docTypeId": 22,
                "docTypeName": "PO",
                "docGuid": "2a4abda6-65c3-4c3b-9858-13842829c977",
                "docDate": "2025-01-28T00:00:00",
                "docOrgId": 379,
                "docOrgCode": "CGE2023/019",
                "docOrgName": "ททท.-Amazing Northern Life",
                "docStatus": 2,
                "taskType": 0,
                "taskTypeName": "Approve",
                "message": "  Total State 2",
                "taskTimeStamp": "2025-01-28T16:19:10.46",
                "taskBy": "taskcenter",
                "dueDate": null,
                "toDocTypeId": null,
                "toDocTypeName": "",
                "refSettingId": "36ad3644-d645-420c-b077-85d6e4ed3326",
                "createAction": 1,
                "createActionName": "Complete",
                "requireAction": 2,
                "requireActionName": "Approve",
                "userAvatar": "http://localhost:53037/Avatar/b374b05d-2b2a-40d8-8039-562bf3233ef0?s=200",
                "isDone": false,
                "checkpoint": false,
                "isArchive": false,
                "isView": null,
                "accessAble": true,
                "workerName": "taskcenter",
                "docAmount": 1000.000000,
                "subDocTypeId": 231,
                "subDocTypeName": "231",
                "currency": "THB"
            }
        ]
    }
     
    
## Comment

| API |
| ------------- |
| Get comment list count |
| Get comment list |
| Get comment detail|
| Send comment|

### Get comment list count

> API สำหรับดึงรายการเอกสารทั้งหมดและจำนวน comment ของแต่ละรายการ

![image](https://hackmd.io/_uploads/HJBvDBWryx.png)

**Request Body**

    {
        userId: int,
        companyId: int
    }

**Response**

    {
        module: string,
        documentCommentCount: int
    }[]
    
**Example**

    [
        {
            "module": "Procurement",
            "documentCommentCount": 5
        },
        {
            "module": "Account",
            "documentCommentCount": 1
        },
        {
            "module": "Inventory",
            "documentCommentCount": 0
        },
        {
            "module": "ListManager",
            "documentCommentCount": 0
        },
        {
            "module": "TimeSheet",
            "documentCommentCount": 0
        },
        {
            "module": "Project",
            "documentCommentCount": 0
        },
        {
            "module": "Sale",
            "documentCommentCount": 0
        }
    ]
    
### Get comment list

> API สำหรับดึงรายการเอกสารทั้งหมดและจำนวน comment ของแต่ละรายการ

![image](https://hackmd.io/_uploads/HJBvDBWryx.png)

**Request Body**
    
    {
        userId: int,
        companyId: int,
        docTypeId: DocTypeEnum[],
        skip: int,
        take: int
    }

**Response**

    {
        module: string,
        documentComments: [
            {
                docId: string,
                docGuid: string,
                docCode: string,
                docTypeId: DocTypeEnum,
                orgName: string,
                commentCount: int
            }
        ] 
    }[]
    
**Example**

    {
        "module": "Procurement",
        "documentComments": [
            {
                "docId": 2769,
                "docGuid": "2ec3e4f0-708b-4d43-bc38-0ea62809f5e7",
                "docCode": "Doctype2501-0003",
                "docTypeId": 22,
                "orgName": "ททท.-Amazing Northern Life",
                "commentCount": 1
            }
        ] 
    },
    {
        "module": "Account",
        "documentComments": []
    },
    {
        "module": "Inventory",
        "documentComments": []
    },
    {
        "module": "ListManager",
        "documentComments": []
    },
    {
        "module": "TimeSheet",
        "documentComments": []
    },
    {
        "module": "Project",
        "documentComments": []
    },
    {
        "module": "Sale",
        "documentComments": []
    }

### Get comment detail

> API สำหรับดึง comment ของเอกสาร

![image](https://hackmd.io/_uploads/SJy8wH-HJe.png)

**Request Body**

    {
        docGuid: string
    }

**Response**
    
    {
        docId: int,
        docGuid: string,
        docTypeId: DocTypeEnum,
        docTypeName: string,
        commentList: {
            imageUrl: string,
            text: string,
            createdAt: DateTime
            }[]
    }

### Send comment

> API สำหรับเพิ่ม comment

![image](https://hackmd.io/_uploads/rkZHDHbS1l.png)

**Request Body**

    {
        userId: number | string,
        comment: string
        documentDetail: {
            docId: int,
            docGuid: string,
            docTypeId: DocTypeEnum,
            docTypeName: string
    }
    }
**Response**
    
    {
        message: string,
        isMention: bool
    }
    
**Example**

    {
        message: "SUCCESS",
        isMention: true
    }
    
### Send comment mention
> API สำหรับเพิ่ม comment mention

![image](https://hackmd.io/_uploads/rkZHDHbS1l.png)

**Request Body**

    {
        docId: int,
        docTypeId: DocTypeEnum,
        createAction: string, // "Mention"
        date: datetime,
        message: string // @user
    }
**Response**
    
    {
        bool
    }
    
**Example**

    {
        true
    }

## MasterData

| API |
| ------------- |
| GetDocTypeEnum |
| GetExtOrgList |
| GetEmployeeList |
| GetOrganizationList |

### GetDocTypeEnum
> API สำหรับเพิ่มดึงข้อมูล doctype

**Request Body**

    {    
    }
**Response**
    
    {
        Value: int,
        Name: string
    }[]
    
**Example**

    {
        Value: 22,
        Name: "PO"
    },
    {
        Value: 24,
        Name: "Request"
    }
    
### GetExtOrgList
> API สำหรับเพิ่มดึงข้อมูล ExtOrg

**Request Body**

    {    
        skip: int,
        take: int,
        type: string,
        filter: string
    }
**Response**
    
    {
        Id: int,
        Code: string,
        Name: string,
        TypeTag: string
    }[]
    
**Example**

    {
        Id: 3650,
        Code: "S01821",
        Name: "ศักดิ์สิทธิ์ ภัทรประกฤต",
        TypeTag: "Supplier"
    },
    {
        Id: 3644,
        Code: "S01820",
        Name: "ธนาคารพัฒนาวิสาหกิจขนาดกลางและขนาดย่อมแห่งประเทศไทย,
        TypeTag: "Supplier,Customer"
    }
    
### GetEmployeeList
> API สำหรับเพิ่มดึงข้อมูล Employee

**Request Body**

    {    
        skip: int,
        take: int,
        filter: string
    }
**Response**
    
    {
        Id: int,
        Code: string,
        Name: string,
        Type: string
    }[]
    
**Example**

    {
        Id: 63,
        Code: "UserTest",
        Name: "User Approve1",
        UserName: "pjm",
        Type: "Employee"
    },
    {
        Id: 59,
        Code: "PJM2API",
        Name: "Pojjaman2 API",
        UserName: "PJM2API",
        Type: "Employee"
    }
    
### GetOrganizationList
> API สำหรับเพิ่มดึงข้อมูล Organization

**Request Body**

    {    
        skip: int,
        take: int,
        filter: string,
        userId: int,
        companyId: int
    }
**Response**
    
    {
        Id: int,
        Code: string,
        Name: string
    }[]
    
**Example**

    {
        "Id": 379,
        "Code": "CGE2023/019",
        "Name": "ททท.-Amazing Northern Life"
    },
    {
        "Id": 380,
        "Code": "CGE2023/020",
        "Name": "ททท.-Amazing Northern Life 2"
    }


# PJM2AppNotification

## Environment
| Name       | Endpoint                          | AuthString                                                               |
| ---------- | --------------------------------- | ------------------------------------------------------------------------ |
| Test       | https://ptc-api-test.builk.com | eyJVc2VyTmFtZSI6IlBqbVNlcnZlcjJTZXJ2ZXIiLCJQYXNzd29yZCI6InI9KTUpKm9cMDJROyJ9 |
| Production |https://ptc-api.builk.com | eyJVc2VyTmFtZSI6IlBqbVNlcnZlcjJTZXJ2ZXIiLCJQYXNzd29yZCI6InI9KTUpKm9cMDJROyJ9 |

## Commom response model
> เป็น model ที่นำไปใช้ในการตอบกลับของทุกๆ API และจะละเว้นการอธิบาย model นี้ในทุกๆ API ต่อไป

| Parameter  | Description                         | Schema |
| ---------  | -------------------------------------- |-------------| 
| Data       | ค่าที่ตอบกลับจากการทำงานของAPI นั้นๆ (ไม่มีการตอบกลับอนุญาติให้เป็น null) | Object |
| Status     | สถานะการทำงานของ API นั้นๆ โดยหมวด 2xx คือทำงานปกติ 4xx คือข้อมูลบ้างอย่างไม่ถูกต้อง และ 5xx เป็นการทำงานผิดปกติของทาง API โดยถ้าได้รับ status หมวด 5xx สามารถแจ้งทีมงานเพื่อตรวจสอบได้ | Integer |
| Messge | คำอธิบายขยายความของ Status เบื้องต้น โดยหมวด 2xx จะเป็น success 4xx ส่วนใหญ่จะเป็นข้อบงชี้ของข้อมูลที่ไม่ถูกต้อง และ 5xx จะเป็น error ของตัวระบบ  | String 


## Conversation Agreement

### DataType

#### NotificationScopeEnum

| Key          | Value |
| ------------ | ----- |
| User         | 1     |
| Organization | 2     |
| Email        | 3     |

#### NotificationTypeEnum

| Key            | Value |
| -------------- | ----- |
| RequestApprove | 1     |
| Approved       | 2     |
| Rejected       | 3     |
| Comment        | 4     |
| Mention        | 5     |

#### ApplicationModule

| Key                                 | Value |
| ----------------------------------- | ----- |
| ProjectNBudget (Project and budget) | 1     |
| Sales                               | 2     |
| Procurement                         | 3     |
| Timesheet                           | 4     |
| Account                             | 5     |
| Inventory                           | 6     |
| CustomDoc                           | 7     |
| ListManager (Master data)           | 8     |

## `POST api/V1/External/PJMNotification/SendNotification`
`ใช้สำหรับส่งการแจ้งเตือนไปยังอุปกรณ์เคลื่อนที่ ที่ลงทะเบียนไว้ทั้งในระบบปฏิบัตการ IOS และ Android`

**Header Request**

| Key           | Value                      |
| ------------- | -------------------------- |
| authorization | Bearer {[AuthString](#Environment)} |

**Body Request**

| Parameter                                                 | Description                                       | Schema     | default |
| --------------------------------------------------------- | ------------------------------------------------- | ---------- | ------- |
| [NotificationScope](#NotificationScopeEnum)  (*required*) | Type of identity                                  | number     | 1       |
| [NotificationType](#NotificationTypeEnum) (*required*)    | Type of topic notification                        | number     | N/A     |
| [ApplicationModule](#ApplicationModule) (*required*)      | Type of module in app                             | number     | N/A     |
| UserId (*required*)                                       | PJM User id in number type                        | number     | null    |
| OrgId                                                     | PJM organization id in number type                | number     | null    |
| Email                                                     | PJM user email                                    | string     | null    |
| UseCustomMessage                                          | Flag to enable to use test from request           | boolean    | false   |
| Payload                                                   | Body of request for use to handle navigate in app | dictionary | null    |
| MessageTH                                                 | Custom message in Thai language                   | object     | null    |
| MessageEN                                                 | Custom message in English language                | object     | null    |

**Payload  dictionary**
`Default payload`

| Parameter | Description              | Schema | default |
| --------- | ------------------------ | ------ | ------- |
| docCode  (*required*)   |     | string | null    |
| docGuid   (*required*)   |  | string | null    |
| docId    (*required*)  |  | string | null    |
| docType    (*required*)  |  | string | null    |
| subDocType   (*required*)   |  | string | null    |
| actor      | Name of aprrove or reject document  | string | null    |
| mentorName      | Name of mentor when comment and mention to target  | string | null    |
| commentName      | Name of commentor  | string | null    |
| commentMessage      | value of comment  | string | null    |
| [docModule](#ApplicationModule)   (*required*)   |  | string | null    |

**Message`[TH | EN]` Object**

| Parameter | Description              | Schema | default |
| --------- | ------------------------ | ------ | ------- |
| Title     | Title of notification    | string | null    |
| Body      | Content of notifivcation | string | null    |

**Body Response**
| Parameter | Description          | Schema  |
| --------- | -------------------- | ------- |
| Data      | Status of processing | boolean |


#### Example Request 1
```json
{
  "notificationScope": 1,
  "notificationType": 1,
  "userId": "73",
  "orgId": null,
  "email": null,
  "payload": {
    "docCode": "DOC-00001",
    "docGuid": "88f6ad50-c9ae-4220-93f0-e9dd6d5125d2",
    "docId": "3",
    "docType" :"1",
    "subDocType":"2",
    "docModule":"1",
  },
  "useCustomMessage": false,
  "messageTH": null,
  "messageEN": null
}
```

#### Example Response  1
```json
{
    "Status": 200,
    "Message": "success",
    "Data": true
}
```

#### Example Request 2
```json
{
  "notificationScope": 1,
  "notificationType": 1,
  "userId": "73",
  "orgId": null,
  "email": null,
  "payload": {
    "docCode": "DOC-00001",
    "docGuid": "88f6ad50-c9ae-4220-93f0-e9dd6d5125d2",
    "docId": "3",
    "docType" :"1",
    "subDocType":"2",
    "docModule":"1",
  },
  "useCustomMessage": true,
  "messageTH": {
    "title": "มีเอกสารรอนุมัติ",
    "body": "มีเอกสารรอนุมัติ",
  },
  "messageEN": {
    "title": "Have new document waiting approve",
    "body": "Have new document waiting approve"
  }
}
```

#### Example Response  2
```json
{
    "Status": 200,
    "Message": "success",
    "Data": true
}
```