# Builk-360 Dashboard API
## Preparing request
### Filter model
> Every api use this filter model
**Body Request**
| Parameter | Description | Schema |
| ---------------------------------- | ------------------------------------------ | ------------------------ |
| projectId (*required*) | Identity project of data set | number |
| userId (*required*) | Identity user of data set | number |
| periodType (*required*) | Type Period time of data set | value of periodTypeEnum |
| startDate (*option*) | required when periodType is date range | date (ISO format) |
| endDate (*option*) | required when periodType is date range | date (ISO format) |
#### Example Request #1
```json
{
"projectId": 1,
"userId": 15,
"periodType": 1,
"startDate": null,
"endDate": null
}
```
#### Example Request #2
```json
{
"projectId": 44,
"userId": 112,
"periodType": 5,
"startDate": "2021-02-21T08:45:42.547Z",
"endDate": "2021-02-21T08:45:42.547Z"
}
```
### PeriodTypeEnum
> Api will use this enum to mapping
| Key | Value | Description |
| --------- | -------| -------------------------------------------------------------------------------- |
| Today | 1 | Dataset of the day |
| ThisWeek | 2 | Dataset of the week |
| ThisMonth | 3 | Dataset of the month |
| Period | 4 | Dataset of choose period time *required startDate and endDate in filter model* |
| Project | 5 | Dataset all time |
## Api request
### `POST api/v1/ProjectDashboard/ActivitySummary`

**Response**
| Parameter | Description | Schema |
| ----------- | ----------------------------------------------------------------------------- | ------ |
| data | ActivitySummaryModel | object |
| status | 200 when has data, 204 hasn't data , 400 request error and 500 server error | number |
| message | detail of error | string |
**ActivitySummaryModel**
| Parameter | Description | Schema |
| ----------------- | ------------------ | ------ |
| viewDetail | ValueDifferentModel | object |
| commentPinsDetail | ValueDifferentModel | object |
| commentDetail | ValueDifferentModel | object |
| replyDetail | ValueDifferentModel | object |
**ValueDifferentModel**
| Parameter | Description | Schema |
| ----------------- | ------------------------------------------------------------------- | ------ |
| count | count value of data set | number |
| diffOfPercentage | diff value of data set | number |
| diffOfStatus | status of diff value -1 is negative , 0 is normaly and 1 is positive | number |
#### Example Response #1 when success
```json
{
"data": {
"viewDetail" : {
"count" : 0,
"diffOfPercentage" : 10,
"diffOfStatus" : 0
},
"commentPinsDetail" : {
"count" : 356,
"diffOfPercentage" : 45,
"diffOfStatus" : 1
},
"commentDetail" : {
"count" : 687,
"diffOfPercentage" : 32,
"diffOfStatus" : 1
},
"replyDetail" : {
"count" : 45,
"diffOfPercentage" : 7,
"diffOfStatus" : -1
}
},
"status": 200,
"message": "success"
}
```
#### Example Response #2 when request error
```json
{
"data": null,
"status": 400,
"message": "PeriodTypeEnum Period is required startDate and endDate"
}
```
### `POST api/v1/ProjectDashboard/TypeOfCommentAndReplySummary`

**Response**
| Parameter | Description | Schema |
| ----------- | ----------------------------------------------------------------------------- | ------ |
| data | TypeOfCommentAndReplySummaryModel | object |
| status | 200 when has data, 204 hasn't data , 400 request error and 500 server error | number |
| message | detail of error | string |
**TypeOfCommentAndReplySummaryModel**
| Parameter | Description | Schema |
| ----------------- | ------------------ | ------ |
| total | sum of comments and replies | number |
| dataSet | Array of DataSetModel | object |
**DataSetModel**
| Parameter | Description | Schema |
| ----------------- | ------------------------------------------------------------------- | ------ |
| order | number for use order data row | number |
| labelName | name of data row | string |
| countComment | count of comment with name type this | number |
| percentage | percentage of name type this in overall data | number |
#### Example Response
```json
{
"data": {
"total" : 999,
"dataSet" : [
{
"order" : 1,
"labelName" : "NO TAG",
"countComment" : 99,
"percentage" : 5
},
{
"order" : 2,
"labelName" : "RFI",
"countComment" : 99,
"percentage" : 5
},
{
"order" : 3,
"labelName" : "DEFECT",
"countComment" : 99,
"percentage" : 5
},
{
"order" : 4,
"labelName" : "ACTION",
"countComment" : 99,
"percentage" : 5
},
{
"order" : 5,
"labelName" : "GOOD JOB",
"countComment" : 99,
"percentage" : 5
},
]
},
"status": 200,
"message": "success"
}
```
### `POST api/v1/ProjectDashboard/CommentsActivity`

**Response**
| Parameter | Description | Schema |
| ----------- | ----------------------------------------------------------------------------- | ------ |
| data | CommentsActivityModel | object |
| status | 200 when has data, 204 hasn't data , 400 request error and 500 server error | number |
| message | detail of error | string |
**CommentsActivityModel**
| Parameter | Description | Schema |
| ----------------- | ------------------ | ------ |
| total | sum of comments and replies | number |
| dataSet | Array of DataSetModel | object |
**DataSetModel**
| Parameter | Description | Schema |
| ----------------- | ------------------------------------------------------------------- | ------ |
| order | number for use order data row | number |
| labelName | name of data row | string |
| countNoTag | count comment of no tag type | number |
| countRFI | count comment of RFI type | number |
| countDefect | count comment of defect type | number |
| countAction | count comment of action type | number |
| countGoodJob | count comment of good job type | number |
#### Example Response
```json
{
"data": {
"total" : 999,
"dataSet" : [
{
"order" : 1,
"labelName" : "Sun",
"countNoTag" : 99,
"countRFI" : 99,
"countDefect" : 99,
"countAction" : 99,
"countGoodJob" : 99,
},
{
"order" : 2,
"labelName" : "Mon",
"countNoTag" : 99,
"countRFI" : 99,
"countDefect" : 99,
"countAction" : 99,
"countGoodJob" : 99,
},
...
...
...
{
"order" : 7,
"labelName" : "Sat",
"countNoTag" : 99,
"countRFI" : 99,
"countDefect" : 99,
"countAction" : 99,
"countGoodJob" : 99,
},
]
},
"status": 200,
"message": "success"
}
```
### `POST api/v1/ProjectDashboard/UserMentionActivity`

**Additional Request**
| Parameter | Description | Schema |
| ----------------------- | ---------------------------------------------------------- | ------- |
| filterType (*required*) | 0 = all , 1 = replied , 2 = not yet replied (default all) | number |
| page (*required*) | number of pagination start at 0 | number |
| perPage (*required*) | number of data return (-1 is take all) | number |
**Response**
| Parameter | Description | Schema |
| ----------- | ----------------------------------------------------------------------------- | ------ |
| data | Array of UserMentionActivityModel | object |
| status | 200 when has data, 204 hasn't data , 400 request error and 500 server error | number |
| message | detail of error | string |
**UserMentionActivityModel**
| Parameter | Description | Schema |
| ---------------------- | ------------------------------------- | -------------------------- |
| mentionName | name of user mention | string |
| mentionImage | url image of user mention | string |
| mentionDateTime | date time of master mention | date |
| mentionType | type of mention | value of mentionTypeEnum |
| mentionText | value of master mention | string |
| mentionYourReplyText | has value when type is replied | string |
| plan | location plan of activity | number |
| tour | location tour of activity | number |
| postNo | location postNo of activity | number |
| comment | location comment of activity | number |
**MentionTypeEnum**
| Key | Value | Description |
| --------- | -------| ----------- |
| NoTag | 0 | |
| RFI | 1 | |
| Defect | 2 | |
| Action | 3 | |
| GoodJob | 4 | |
| Replied | -1 | |
#### Example Request
```json
{
"projectId": 62,
"userId": 10,
"periodType": 1,
"startDate": null,
"endDate": null,
"filterType": 0,
"page": 0,
"perPage": -1,
}
```
#### Example Response
```json
{
"data": [
{
"mentionName" : "Patai",
"mentionImage" : "url...",
"mentionDateTime" : "2021-02-21T08:45:42.547Z",
"mentionType" : 2,
"mentionText" : "ขอข้อมูล meterial เพิ่ม",
"mentionYourReplyText" : null,
"plan" : 160,
"tour" : 441,
"postNo" : 01,
"comment" : 01
},
{
"mentionName" : "Pongsawat",
"mentionImage" : "url...",
"mentionDateTime" : "2021-02-21T08:45:42.547Z",
"mentionType" : -1,
"mentionText" : "ขอข้อมูล meterial เพิ่ม",
"mentionYourReplyText" : "ปรับหน้างานแล้วคะ",
"plan" : 160,
"tour" : 441,
"postNo" : 01,
"comment" : 01
},
...
...
...
{
"mentionName" : "Patai",
"mentionImage" : "url...",
"mentionDateTime" : "2021-02-21T08:45:42.547Z",
"mentionType" : 2,
"mentionText" : "ขอข้อมูล meterial เพิ่ม",
"mentionYourReplyText" : null,
"plan" : 160,
"tour" : 441,
"postNo" : 01,
"comment" : 01
},
],
"status": 200,
"message": "success"
}
```
### `POST api/v1/ProjectDashboard/ActivityRanking`

**Response**
| Parameter | Description | Schema |
| ----------- | ----------------------------------------------------------------------------- | ------ |
| data | Array of UserActivityRankingModel | object |
| status | 200 when has data, 204 hasn't data , 400 request error and 500 server error | number |
| message | detail of error | string |
**UserActivityRankingModel**
| Parameter | Description | Schema |
| -------------- | --------------------------------- | ------- |
| userName | name of user has activity | string |
| countComment | number of activity comment | number |
| countMention | number of activity mention | number |
| countReply | number of activity reply | number |
| totalAction | sum of all activity | number |
#### Example Response
```json
{
"data": [
{
"userName" : "Patai",
"countComment" : 99,
"countMention" : 99,
"countReply" : 99,
"totalAction" : 297,
},
{
"userName" : "Patai",
"countComment" : 99,
"countMention" : 99,
"countReply" : 99,
"totalAction" : 297,
}
],
"status": 200,
"message": "success"
}
```