mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
pass limit from ap/get to resolveCollectionItems
This commit is contained in:
parent
1ab5ceb65a
commit
3da3ce9a40
2 changed files with 3 additions and 1 deletions
|
@ -35,6 +35,7 @@ export const paramDef = {
|
||||||
properties: {
|
properties: {
|
||||||
uri: { type: 'string' },
|
uri: { type: 'string' },
|
||||||
expandCollectionItems: { type: 'boolean' },
|
expandCollectionItems: { type: 'boolean' },
|
||||||
|
expandCollectionLimit: { type: 'integer', nullable: true },
|
||||||
allowAnonymous: { type: 'boolean' },
|
allowAnonymous: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['uri'],
|
required: ['uri'],
|
||||||
|
@ -50,7 +51,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const object = await resolver.resolve(ps.uri, ps.allowAnonymous ?? false);
|
const object = await resolver.resolve(ps.uri, ps.allowAnonymous ?? false);
|
||||||
|
|
||||||
if (ps.expandCollectionItems && isCollectionOrOrderedCollection(object)) {
|
if (ps.expandCollectionItems && isCollectionOrOrderedCollection(object)) {
|
||||||
const items = await resolver.resolveCollectionItems(object, undefined, ps.allowAnonymous ?? false);
|
const items = await resolver.resolveCollectionItems(object, ps.expandCollectionLimit, ps.allowAnonymous ?? false);
|
||||||
|
|
||||||
if (isOrderedCollection(object) || isOrderedCollectionPage(object)) {
|
if (isOrderedCollection(object) || isOrderedCollectionPage(object)) {
|
||||||
object.orderedItems = items;
|
object.orderedItems = items;
|
||||||
|
|
|
@ -12919,6 +12919,7 @@ export type operations = {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
uri: string;
|
uri: string;
|
||||||
expandCollectionItems?: boolean;
|
expandCollectionItems?: boolean;
|
||||||
|
expandCollectionLimit?: number | null;
|
||||||
allowAnonymous?: boolean;
|
allowAnonymous?: boolean;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue