Skip to content

Conversation

@stepanenkoxx
Copy link
Collaborator

No description provided.

@stepanenkoxx stepanenkoxx force-pushed the DLAPI-248-refactor-get-entry-endpoint branch from a3d0c33 to 09cb85c Compare June 10, 2025 14:37
@stepanenkoxx stepanenkoxx force-pushed the DLAPI-248-refactor-get-entry-endpoint branch 2 times, most recently from 97c7157 to ac582a5 Compare July 2, 2025 13:15
Comment on lines +138 to +140
throw new AppError(US_ERRORS.NOT_EXIST_ENTRY, {
code: US_ERRORS.NOT_EXIST_ENTRY,
});
Copy link
Collaborator Author

@stepanenkoxx stepanenkoxx Jul 3, 2025

Choose a reason for hiding this comment

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

In this file I just raised the error above to reduce code nesting

src/routes.ts Outdated
Comment on lines 67 to 82
getEntryV2: makeRoute({
route: 'GET /v2/entries/:entryId',
handler: entries.getEntryV2Controller,
}),
privateGetEntry: makeRoute({
route: 'GET /private/entries/:entryId',
handler: entries.getEntry,
authPolicy: AuthPolicy.disabled,
private: true,
}),
privateGetEntryV2: makeRoute({
route: 'GET /v2/private/entries/:entryId',
handler: entries.getEntryV2Controller,
authPolicy: AuthPolicy.disabled,
private: true,
}),
Copy link
Collaborator Author

@stepanenkoxx stepanenkoxx Jul 3, 2025

Choose a reason for hiding this comment

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

This endpoint has the same contract as the old one, except for includeFavorite param
It seems we can just start sending includeFavorite where necessary in the UI and simply replace the controllers in the old endpoints, i guess we can even switch controllers with flag in US

Copy link
Collaborator

Choose a reason for hiding this comment

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

"i guess we can even switch controllers with flag in US" – good idea

@stepanenkoxx stepanenkoxx marked this pull request as ready for review July 3, 2025 10:13

let userLoginPromise;
if (includeFavorite) {
userLoginPromise = user.login ? user.login : getEntryResolveUserLogin({ctx});
Copy link
Collaborator

Choose a reason for hiding this comment

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

It works correctly, but is it possible to store only promises in userLoginPromise?
user.login ? Promise.resolve(user.login) : getEntryResolveUserLogin({ctx})

};
}

case US_ERRORS.OPERATION_TIMEOUT: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Operation is used for existing entity, can we use Action or Request here?

src/routes.ts Outdated
Comment on lines 67 to 82
getEntryV2: makeRoute({
route: 'GET /v2/entries/:entryId',
handler: entries.getEntryV2Controller,
}),
privateGetEntry: makeRoute({
route: 'GET /private/entries/:entryId',
handler: entries.getEntry,
authPolicy: AuthPolicy.disabled,
private: true,
}),
privateGetEntryV2: makeRoute({
route: 'GET /v2/private/entries/:entryId',
handler: entries.getEntryV2Controller,
authPolicy: AuthPolicy.disabled,
private: true,
}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

"i guess we can even switch controllers with flag in US" – good idea

.where((builder) => {
builder.where({
[`${Entry.tableName}.entryId`]: entryId,
[`${Entry.tableName}.isDeleted`]: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It was the same in the old method, but I think we need to add tenantId here, it's checked below but I don't see the point in not checking it right in the select. Maybe @jhoncool knows the reason why we shouldn't do this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know but I think it's okay to use it here

builder.andWhere({mirrored: true});
}
})
.withGraphJoined(`[${graphRelations.join(', ')}]`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we discussed, we no longer use withGraphJoined, need to create a new presentation (example #318).

@stepanenkoxx stepanenkoxx marked this pull request as draft August 13, 2025 08:09
@stepanenkoxx stepanenkoxx marked this pull request as ready for review August 13, 2025 12:57
} else if (branch === 'saved') {
graphRelations.push('savedRevision(revisionModifier)');
} else {
graphRelations.push('publishedRevision(revisionModifier)');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here should be a fallback to saved revision if the published one does not exist.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was wrong, everything works correctly, because we have branch = 'saved' by default

!isPrivateRoute && !onlyPublic && !onlyMirrored && !isEmbedding;

if (checkWorkbookEnabled) {
iamPermissions = await checkWorkbookEntry({
Copy link
Collaborator

@jhoncool jhoncool Aug 14, 2025

Choose a reason for hiding this comment

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

Should we wrap the checkWorkbookEntry function with withTimeout?

@stepanenkoxx stepanenkoxx force-pushed the DLAPI-248-refactor-get-entry-endpoint branch from 3d06410 to 3f117fe Compare August 14, 2025 12:18
@stepanenkoxx stepanenkoxx merged commit ca5946d into main Aug 14, 2025
8 checks passed
@stepanenkoxx stepanenkoxx deleted the DLAPI-248-refactor-get-entry-endpoint branch August 14, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants