Title: returning same fields three times document overview API
noticed a possible issue in the document overview API route.
File: pages/api/teams/[teamId]/documents/[id]/overview.ts this is the response I'm getting which look like repeating. { "document": { "id": "cmp2a4wj202oxjl04dzi6neie", "name": "Unit-14.pdf", "description": null, "file": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "originalFile": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "type": "pdf", "contentType": "application/pdf", "storageType": "S3_PATH", "numPages": 18, "ownerId": "cmp29sls10005l204u3b1y2f2", "teamId": "cmp29snft04yxjo04xkdhso5g", "agentsEnabled": false, "advancedExcelEnabled": false, "downloadOnly": false, "createdAt": {}, "updatedAt": {}, "folderId": null, "isExternalUpload": false, "versions": [ { "id": "cmp2a4wj202oyjl04j8sl60jv", "versionNumber": 1, "documentId": "cmp2a4wj202oxjl04dzi6neie", "file": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "originalFile": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "type": "pdf", "contentType": "application/pdf", "fileSize": 372438, "storageType": "S3_PATH", "numPages": 18, "isPrimary": true, "isVertical": false, "fileId": null, "vectorStoreFileId": null, "hasPages": false, "length": null, "createdAt": {}, "updatedAt": {} } ], "folder": null, "datarooms": [], "_count": { "links": 0, "views": 0 }, "primaryVersion": { "id": "cmp2a4wj202oyjl04j8sl60jv", "versionNumber": 1, "documentId": "cmp2a4wj202oxjl04dzi6neie", "file": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "originalFile": "cmp29snft04yxjo04xkdhso5g/doc_MF85fwJ7t4z2BQqNJKsJuc/unit-14.pdf", "type": "pdf", "contentType": "application/pdf", "fileSize": 372438, "storageType": "S3_PATH", "numPages": 18, "isPrimary": true, "isVertical": false, "fileId": null, "vectorStoreFileId": null, "hasPages": false, "length": null, "createdAt": {}, "updatedAt": {} }, "hasPageLinks": false, "isEmpty": true }, "limits": { "canAddLinks": true, "canAddDocuments": true, "canAddUsers": false }, "featureFlags": { "annotations": false }, "team": { "plan": "free", "isTrial": false }, "counts": { "links": 0, "views": 0 } }
I wanted to raise this in case it could cause unexpected behavior or typing inconsistencies depending on Prisma version/schema configuration.
Happy to work on a fix if this is considered valid.
Source: papermark/papermark