libresign
libresign copied to clipboard
Unify response of validate and list files from API
Current scenario
Now we have two endpoints. In both is returned an object that represent the tile:
-
/api/{apiVersion}/file/validate/file_id/{fileId}
{
"status": 1,
"statusText": "able to sign",
"fileId": 33,
"uuid": "1ee6aac9-1b74-4174-94fd-b2b9354051df",
"name": "Ingresso Daiane",
"file": "\/apps\/libresign\/p\/pdf\/1ee6aac9-1b74-4174-94fd-b2b9354051df",
"signers": [
{
"signed": null,
"displayName": "",
"fullName": null,
"me": false,
"fileUserId": 2,
"email": "[email protected]"
}
],
"pages": [
{
"url": "",
"resolution": {
"w": 595.276,
"h": 841.89
}
}
],
"settings": {
"canSign": false,
"canRequestSign": true,
"hasSignatureFile": false,
"signerFileUuid": null,
"phoneNumber": "",
"canPreviewPageAsImage": true
}
}
-
/api/{apiVersion}/file/list
{
"data": [
{
"uuid": "f7397d34-90db-43e4-8191-50c5e2d76484",
"name": "133166-150",
"callback": null,
"request_date": "2023-10-05 18:21:24",
"status_date": null,
"requested_by": {
"uid": "admin",
"displayName": null
},
"file": {
"type": "pdf",
"url": "\/apps\/libresign\/pdf\/user\/f7397d34-90db-43e4-8191-50c5e2d76484",
"nodeId": 27
},
"signers": [
{
"email": "[email protected]",
"description": "Description",
"displayName": "[email protected]",
"request_sign_date": "2023-10-05 18:21:25",
"sign_date": null,
"uid": "",
"fileUserId": 1,
"me": false,
"identifyMethods": [
{
"method": "email",
"mandatory": 1,
"identifiedAtDate": null
}
]
}
],
"status": 2,
"status_text": "pending"
}
],
"pagination": {
"total": 2,
"current": null,
"next": null,
"prev": null,
"last": null,
"first": null
}
}
Requirements
- [ ] Use the same code at backend to format the output from API about a file.
- [ ] Validate tests
- [ ] phpcs
- [ ] psalm
- [ ] unit
- [ ] unit + docs
- [ ] Behat
- [ ] Create an issue signalizing the places that use this endpoints at frontend to be possible apply the fixes
Suggestion of return
uuid: From file table
name: From file table
description: From file table
status: From file table
status_text: Using the status code from File table
pages: From file table (inside metadata)
settings:
Handmade applying rules.
properties:
- canSign
- canRequestSign
request_date: From file table
requested_by: From file table
file: Handmade object
properties:
- nodeId: from file table
- URL: generated using uuid from file table
signers
signers:
properties:
- displayName: from file_user table
- me: Will be necessary verify if is the authenticated user
- description: from file_user table
- request_sign_date: from file_user table
- sign_date: from file_user table
- uid: from file_user table. Only will be returned if me=true
- file_user_id: from file_user table
- identifyMethods: : from identify_method table