feat: add custom cover config handling - #958
Conversation
|
Severity: Medium — |
There was a problem hiding this comment.
🟡 Changes recommended
The new custom-cover config handling can leak Mongoose subdocument metadata and the webhook field handling/validation should be tightened for predictable persisted values.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support for organization-scoped “custom cover” configuration (template URLs/spine settings) and propagates an informational customCoverOrg field through Shapeshift webhook handling so compiled books can record which org produced a custom cover.
Changes:
- Add
customCoverConfigto the Organization model and expose a newGET /org/:orgID/custom-cover-configendpoint. - Add
exportInfo.customCoverOrgto the Book model and accept/persist it from the Shapeshift webhook payload. - Extend Shapeshift webhook validation and compilation-status writes to include
customCoverOrg.
File summaries
| File | Description |
|---|---|
| server/models/organization.ts | Introduces CustomCoverConfig type and stores it under Organization.customCoverConfig. |
| server/models/book.ts | Adds exportInfo.customCoverOrg to persist producing-org metadata on compile. |
| server/api/validators/shapeshift.ts | Accepts customCoverOrg in webhook validator. |
| server/api/services/shapeshift-service.ts | Writes exportInfo.customCoverOrg during webhook compile-status updates. |
| server/api/organizations.ts | Adds getCustomCoverConfig handler + validator case + export wiring. |
| server/api.js | Registers the new custom-cover-config route. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e480a26 to
c74b79c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new typings/validation introduce avoidable correctness and safety gaps (unsound CustomCoverConfig required fields vs schema permissiveness, and unbounded customCoverOrg input).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
| export type CustomCoverConfig = { | ||
| enabled: boolean; | ||
| casewrapCoverFrontTemplateURL: string; | ||
| casewrapCoverBackTemplateURL: string; | ||
| perfectboundCoverFrontTemplateURL: string; | ||
| perfectboundCoverBackTemplateURL: string; | ||
| spineHexColor: string; | ||
| spineImageURL?: string; | ||
| matchingPaths: string[]; | ||
| } |
c74b79c to
44ef3f6
Compare
There was a problem hiding this comment.
🟡 Changes recommended
There are unresolved API consistency/exposure concerns (public org info response now includes the new config) and an inconsistent not-found status code that should be aligned.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
| const org = await Organization.findOne( | ||
| { orgID }, | ||
| { _id: 0, defaultProjectLead: 0 }, | ||
| ).lean(); | ||
| if(org?.commonsModules){ | ||
| if (org?.commonsModules) { |
| ).lean(); | ||
|
|
||
| if (!orgData) { | ||
| return res.status(404).send({ |
|
🎉 This PR is included in version 2.151.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.