Skip to content

feat: add custom cover config handling - #958

Merged
jakeaturner merged 1 commit into
stagingfrom
feat/custom-cover-config
Sep 2, 2026
Merged

feat: add custom cover config handling#958
jakeaturner merged 1 commit into
stagingfrom
feat/custom-cover-config

Conversation

@jakeaturner

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI lite review requested due to automatic review settings September 2, 2026 20:03
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Severity: MediumapplyCompileStatus only sets exportInfo.customCoverOrg when the webhook includes it. A later compilation without a custom cover leaves the previous organization value intact, falsely marking the new export as custom-covered. Explicitly $unset the field when customCoverOrg is absent. (shapeshift-service.ts)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 customCoverConfig to the Organization model and expose a new GET /org/:orgID/custom-cover-config endpoint.
  • Add exportInfo.customCoverOrg to 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.

Comment thread server/api/organizations.ts
Comment thread server/api/services/shapeshift-service.ts
Comment thread server/api/validators/shapeshift.ts
Comment thread server/models/organization.ts
@jakeaturner
jakeaturner force-pushed the feat/custom-cover-config branch from e480a26 to c74b79c Compare September 2, 2026 20:16
Copilot AI review requested due to automatic review settings September 2, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread server/api/validators/shapeshift.ts Outdated
Comment on lines +24 to +33
export type CustomCoverConfig = {
enabled: boolean;
casewrapCoverFrontTemplateURL: string;
casewrapCoverBackTemplateURL: string;
perfectboundCoverFrontTemplateURL: string;
perfectboundCoverBackTemplateURL: string;
spineHexColor: string;
spineImageURL?: string;
matchingPaths: string[];
}
Copilot AI review requested due to automatic review settings September 2, 2026 20:34
@jakeaturner
jakeaturner force-pushed the feat/custom-cover-config branch from c74b79c to 44ef3f6 Compare September 2, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment on lines 70 to +74
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({
@jakeaturner
jakeaturner merged commit a132fd9 into staging Sep 2, 2026
8 checks passed
@jakeaturner
jakeaturner deleted the feat/custom-cover-config branch September 2, 2026 20:39
@libretexts-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.151.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants