-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): add endpoint to set a layout as default #2514
Conversation
|
||
const BASE_PATH = '/v1/layouts'; | ||
|
||
export const createLayout = async (session: UserSession, name: LayoutName, isDefault: boolean): Promise<LayoutDto> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created this helper file as the layout creation functionality is being reused in all the tests.
await this.setIsDefaultForLayout(command.layoutId, command.environmentId, command.organizationId, true); | ||
} catch (error) { | ||
Logger.error(error); | ||
// TODO: Rollback through transactions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have no transactions implementation in the Mongoose adapter repository. Something to do across the stack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you maybe just revert the pnpm-lock changes?
6e3f237
to
2caf6ce
Compare
Done. I had some problems with my environment and had to reinstall dependencies the other day. |
What change does this PR introduce?
Adds endpoint and use case to set a layout as default. If there is an existing default layout in the same environment, it will set it to non default while setting as default the chosen one.
Why was this change needed?
The endpoint is probably not going to be used but the use case will be reused in the creation and update endpoints when the
isDefault
property is sent as true. As we can only have one default template per environment we need this functionality.Other information (Screenshots)