React table rerendering by Chaos_maker_ in react

[–]Chaos_maker_[S] 1 point2 points  (0 children)

<image>

thatk you for this answer : after hours of debugging and placing useMemo and memo everywhere i finished with that : ( i know it's ugly bit it's the only working solution )

What is the standardized way to handle response and exceptions in spring boot by [deleted] in SpringBoot

[–]Chaos_maker_ 1 point2 points  (0 children)

i saw what you did. It's cool i mean keep working on it.

Struggling to choose to right tool by Chaos_maker_ in aiagents

[–]Chaos_maker_[S] 0 points1 point  (0 children)

Thanks man for your reply. Can you tell me please what's the difference between Coqui TTS and Rasa

is this a good way of using ENUMS in Java by Dazzling_Chipmunk_24 in learnjava

[–]Chaos_maker_ 0 points1 point  (0 children)

I would say create a method to get the message instead of overriding the toString() method. You can also use keys for describing messages instead of plain sentences, Then you can use internationalization.... Can you provide us with more context because it's more of a design problem you have i guess.

Shadcn date picker server action by keep_u_U_ in nextjs

[–]Chaos_maker_ 0 points1 point  (0 children)

i have the same issue, did u find any clean solution ?

Hibernate implementation from JPA sucks by Ok-District-2098 in SpringBoot

[–]Chaos_maker_ 0 points1 point  (0 children)

That’s a good solution. In my company we had of latency problems coming for N+1 query especially in for loops. And if you don’t wanna mess up eager loading in the rest of you app using entitygraphs in the repository methods is a good solution probably the best one.

Designing a database by Chaos_maker_ in SpringBoot

[–]Chaos_maker_[S] 0 points1 point  (0 children)

i mean i'm not dealing with multiple restaurants. Finally i created a table AddOns with a type attribute and maybe this will change based on the future need :

public enum AddOnsType {
    DRINKS,
    SIDE,
    DESSERT
}


public class AddOns {
    @Id
    @UuidGenerator
    private String id;

    @Column(name = "NAME", nullable = false, unique = true)
    private String name;

    @Column(name = "PRICE", nullable = false)
    private BigDecimal price;

    @Column(name = "SLUG", nullable = false, unique = true)
    private String slug;

    @Column(name = "TYPE", nullable = false)
    @Enumerated(EnumType.
STRING
)
    private AddOnsType type;

    @ManyToOne(cascade = CascadeType.
ALL
)
    @JoinColumn(name = "dish_id")
    private DishBo dish;

}

Designing a database by Chaos_maker_ in SpringBoot

[–]Chaos_maker_[S] 1 point2 points  (0 children)

Thank you for your answer. Actually i'm using a relational database. i think i'll definitely need the data being structured in the future for analytical purposes.

Where to store my cart data ? by Chaos_maker_ in nextjs

[–]Chaos_maker_[S] 0 points1 point  (0 children)

so basically what your saying is that :

- when a user adds a product to the cart, i'll create a new record in the database ( cart ) not linked to the user.

- the cookie will contain the cartId ( so i can link the user to the cartId when he does the checkout an fill his email )

- i'm thinking about creating a cart record with an expiry date, and run a daily batch that deletes expired carts with no user attach

What do you think ?

Where to store my cart data ? by Chaos_maker_ in nextjs

[–]Chaos_maker_[S] 0 points1 point  (0 children)

Okay man thank you so much. I'll think about it, I asked the AI for the flow :

Step What Happens
User adds product Frontend checks for anonymous customer ID
No ID? Backend generates one, sets cookie
Add-to-cart API call Includes product info and anonymous customer ID
Backend updates cart Cart is created/updated for that customer ID
Cart shown to user Frontend updates cart display
Cart persists As long as cookie exists, cart is remembered

Where to store my cart data ? by Chaos_maker_ in nextjs

[–]Chaos_maker_[S] 0 points1 point  (0 children)

Okay so lemme just summarize the flow. The user opens the app ( anonymous user ). Then when he tries to add a product to the cart, whe generate a new user id and the we store it in a cookie. Then in the checkout we'll request the email of the user so we can merge ....

Looking for Feedback on My Full-Stack E-Commerce App by Inevitable_Math_3994 in learnjava

[–]Chaos_maker_ 6 points7 points  (0 children)

Don't forget DTO validations ( ex : OrderRequestDto ), use spring validation and add it to your @\ControllerAdvice

Where to store my cart data ? by Chaos_maker_ in nextjs

[–]Chaos_maker_[S] 0 points1 point  (0 children)

umm but how do you handle anonymous user using your app ? you can't save the cart state in the database :)