Skip to content

Commit

Permalink
✨ Add tableOfContents for book listing
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 13, 2024
1 parent d26064e commit e86c91a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/routes/likernft/book/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ router.post(['/:classId/new', '/class/:classId/new'], jwtAuth('write:nftbook'),
mustClaimToView = false,
hideDownload = false,
enableCustomMessagePage = false,
tableOfContents,
autoDeliverNFTsTxHash,
} = req.body;
const [iscnInfo, metadata] = await Promise.all([
Expand Down Expand Up @@ -479,6 +480,7 @@ router.post(['/:classId/new', '/class/:classId/new'], jwtAuth('write:nftbook'),
shippingRates,
mustClaimToView,
enableCustomMessagePage,
tableOfContents,
hideDownload,

// From ISCN content metadata
Expand Down Expand Up @@ -532,6 +534,7 @@ router.post(['/:classId/new', '/class/:classId/new'], jwtAuth('write:nftbook'),
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,
});

res.json({
Expand All @@ -553,6 +556,7 @@ router.post(['/:classId/settings', '/class/:classId/settings'], jwtAuth('write:n
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,
} = req.body;
const bookInfo = await getNftBookInfo(classId);
if (!bookInfo) throw new ValidationError('CLASS_ID_NOT_FOUND', 404);
Expand All @@ -569,6 +573,7 @@ router.post(['/:classId/settings', '/class/:classId/settings'], jwtAuth('write:n
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,
});

publisher.publish(PUBSUB_TOPIC_MISC, req, {
Expand Down
2 changes: 2 additions & 0 deletions src/util/ValidationHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ export function filterNFTBookListingInfo(bookInfo, isOwner = false) {
mustClaimToView = false,
hideDownload = false,
enableCustomMessagePage,
tableOfContents,
signedMessageText,
enableSignatureImage,
inLanguage,
Expand All @@ -713,6 +714,7 @@ export function filterNFTBookListingInfo(bookInfo, isOwner = false) {
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,
signedMessageText,
enableSignatureImage,
inLanguage,
Expand Down
5 changes: 5 additions & 0 deletions src/util/api/likernft/book/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export async function newNftBookInfo(classId, data, apiWalletOwnedNFTIds: string
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,

inLanguage,
name,
Expand Down Expand Up @@ -185,6 +186,7 @@ export async function newNftBookInfo(classId, data, apiWalletOwnedNFTIds: string
if (enableCustomMessagePage !== undefined) {
payload.enableCustomMessagePage = enableCustomMessagePage;
}
if (tableOfContents) payload.tableOfContents = tableOfContents;
let batch = db.batch();
batch.create(likeNFTBookCollection.doc(classId), payload);
if (apiWalletOwnedNFTIds.length) {
Expand Down Expand Up @@ -289,6 +291,7 @@ export async function updateNftBookInfo(classId: string, {
mustClaimToView,
hideDownload,
enableCustomMessagePage,
tableOfContents,
}: {
prices?: any[];
notificationEmails?: string[];
Expand All @@ -298,6 +301,7 @@ export async function updateNftBookInfo(classId: string, {
mustClaimToView?: boolean;
hideDownload?: boolean;
enableCustomMessagePage?: boolean;
tableOfContents?: string;
} = {}, newAPIWalletOwnedNFTIds: string[] = []) {
await syncNFTBookInfoWithISCN(classId);

Expand All @@ -317,6 +321,7 @@ export async function updateNftBookInfo(classId: string, {
if (enableCustomMessagePage !== undefined) {
payload.enableCustomMessagePage = enableCustomMessagePage;
}
if (tableOfContents !== undefined) { payload.tableOfContents = tableOfContents; }
const classIdRef = likeNFTBookCollection.doc(classId);
let batch = db.batch();
batch.update(classIdRef, payload);
Expand Down

0 comments on commit e86c91a

Please sign in to comment.