This commit is contained in:
2026-04-30 17:49:07 +08:00
parent 805d6f8cae
commit 9d684cb7b3
615 changed files with 15368 additions and 6172 deletions

View File

@@ -4,6 +4,7 @@ export {
getRpgEntryWorldLibraryDetail,
listRpgEntryWorldGallery,
listRpgEntryWorldLibrary,
likeRpgEntryWorldGallery,
publishRpgEntryWorldProfile,
recordRpgEntryWorldGalleryPlay,
remixRpgEntryWorldGallery,

View File

@@ -152,6 +152,26 @@ describe('rpgEntry public custom world gallery routes', () => {
}),
);
});
it('likes public gallery detail through the authenticated mutation route', async () => {
requestJsonMock.mockResolvedValueOnce({
entry: {
ownerUserId: 'user-1',
profileId: 'profile-1',
likeCount: 2,
},
});
const { likeRpgEntryWorldGallery } = await import('./rpgEntryLibraryClient');
await likeRpgEntryWorldGallery('user-1', 'profile-1');
expect(requestJsonMock).toHaveBeenCalledWith(
'/api/runtime/custom-world-gallery/user-1/profile-1/like',
expect.objectContaining({ method: 'POST' }),
'点赞作品失败',
expect.anything(),
);
});
});
describe('rpgEntry save archive routes', () => {

View File

@@ -115,6 +115,23 @@ export async function recordRpgEntryWorldGalleryPlay(
return response.entry;
}
export async function likeRpgEntryWorldGallery(
ownerUserId: string,
profileId: string,
options: RuntimeRequestOptions = {},
) {
const response = await requestRpgRuntimeJson<
CustomWorldGalleryDetailResponse<CustomWorldProfile>
>(
`/custom-world-gallery/${encodeURIComponent(ownerUserId)}/${encodeURIComponent(profileId)}/like`,
{ method: 'POST' },
'点赞作品失败',
options,
);
return response.entry;
}
export async function getRpgEntryWorldLibraryDetail(
profileId: string,
options: RuntimeRequestOptions = {},
@@ -218,6 +235,7 @@ export const rpgEntryLibraryClient = {
getWorldLibraryDetail: getRpgEntryWorldLibraryDetail,
remixWorldGallery: remixRpgEntryWorldGallery,
recordWorldGalleryPlay: recordRpgEntryWorldGalleryPlay,
likeWorldGallery: likeRpgEntryWorldGallery,
upsertWorldProfile: upsertRpgEntryWorldProfile,
deleteWorldProfile: deleteRpgEntryWorldProfile,
publishWorldProfile: publishRpgEntryWorldProfile,