-
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): disallow delete of assigned #2545
feat(api): disallow delete of assigned #2545
Conversation
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.
⭐️
} from '../../../message-template/usecases'; | ||
|
||
@Injectable() | ||
export class CheckLayoutIsUsedUseCase { |
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.
I guess we could quite easily use this for the isUsed in the FE table we were planning to scope out 🤭
Maybe we could just do it as a query in the front or as an extra return field to the get-layout-usecase , instead of actually adding a field to the schema. Which I definitely don't like.
Actually might have some value in also making it external API accessible.
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.
I do agree that the isUsed
calculation should be done on demand and not by DB flags that could go out of sync easily. And with the rest of your comments.
export class FindMessageTemplatesByLayoutUseCase { | ||
constructor(private messageTemplateRepository: MessageTemplateRepository) {} | ||
|
||
async execute(command: FindMessageTemplatesByLayoutCommand): Promise<MessageTemplateEntity[]> { |
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.
I really like all these separations. You think ahead💪🏻
I see multiple possible future uses for this
What change does this PR introduce?
Avoids that a layout is deleted if it is being used by a message template.
Why was this change needed?
To avoid data corruption by users actions.
Other information (Screenshots)