Skip to content
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

Create advertisement #119

Merged
merged 8 commits into from
Dec 15, 2024
Merged

Create advertisement #119

merged 8 commits into from
Dec 15, 2024

Conversation

Troter2
Copy link
Contributor

@Troter2 Troter2 commented Dec 14, 2024

No description provided.

@Troter2 Troter2 changed the title Craete advertisement Create advertisement Dec 14, 2024
@Troter2 Troter2 requested a review from rogargon December 14, 2024 23:26
private void initializeAdStatus() {
if (this.adStatus == null) {
this.adStatus = AdvertisementStatusRepositoryHolder.getRepository()
.findById(1L)
Copy link
Member

Choose a reason for hiding this comment

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

It is risky to depend on a specific ID; it is better to use find by status name, which also makes the code easier to understand. Moreover, if this is critical, you can also create the required status if it has not been done yet.
Finally, if done with a PrePersist and the Handler is not required (note it is Handler, not Holder), the Handler can be removed

Copy link
Member

@rogargon rogargon left a comment

Choose a reason for hiding this comment

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

Please, make the code less dependant on a particular status id as detailed in the corresponding comment

@Troter2
Copy link
Contributor Author

Troter2 commented Dec 15, 2024

Solved

@rogargon rogargon merged commit a884f43 into main Dec 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants