WishlistService
proto
WishlistService
proto
Add tests for bulk delete too Repeat the same pattern for BulkDeleteWishlists: Owner can bulk delete their wishlists ✅ Non-owner cannot bulk delete someone else's wishlists ❌
should state that bulk delete does not throw exception, it returns a list of errors.
"PERMISSION_DENIED"
NOT_FOUND
wishlistContractMapper
opposite mapper needed
WishlistContextBuilder.wishlistContext()
no need for this
.requestContext(ctx)
what is ctx here?
import com.wixpress.framework.testing.requestcontext.RequestContextIdentityBuilder;
wrong import
Java Automapper context works differently than Scala. Instead of using context in transformers, manually set memberId in your service layer after transformation:
why? this is wrong in my opinion. can use curried functions
// Add to WishlistMappers.java
cannot be in same file
Transformer<Wishlist, WishlistDomain, WishlistTransformerContext> wishlistDomainMapper = Transformer.define(Wishlist.class, WishlistDomain.class, WishlistTransformerContext.class) .withFieldComputed(WishlistDomain::email, wishlist -> wishlist.hasEmail() ? wishlist.getEmail().getValue() : "") .withFieldComputed(WishlistDomain::size, wishlist -> wishlist.getItemsList().size()) .build();
only transformer that needs the ctx
.gdprSupport( builder -> builder.uouAndUserSupport() // ← Use this )
wrong. use: .gdpr(gdprSpec -> gdprSpec .uouAndUserSupport(AppDefId, contextBuilder.secrets().appSecret()) ) before the change it is: .gdpr(gdprSpec -> gdprSpec .userSupportOnly(AppDefId, contextBuilder.secrets().appSecret()) )
✅ Build and celebrate! Build your project now.
need to add filterable to email before otherwise error
query wishlist" test
query wishlist
assertEntityWithoutGeneratedFields(result, expectedWishlist, "vip");
fix to change in assert function not in the call
Add a Translator
add note to put in a new trnaslators file, because when in class mappers the transformers aren't yet build so refrence to the transformer is unknown.
wishlist -> wishlist.getItemsList().size()) // Compute size from items
needs to be (WishlistDomain domain) -> domain.size() > 5
wishlistItemDomainMapper
change name to transformer
Transformer
add public static final
1. Erase old mappings from the generated code
dont need to erase the existing, and also Void.class is unnecessary
Part 3: Connect Proto & Domain (Automapper + PII) 🔄
need to add the step to run the bazel generate model command (in scala exists)