profileShare

rasmusjy / tasteprint

Read-only snapshot

No repository description.

main default branch 169 files Expires Sep 13, 2026, 9:06 AM
SharingController.java 1,027 bytes
1 package com.tasteprint.social;
2
3 import org.springframework.security.core.annotation.AuthenticationPrincipal;
4 import org.springframework.web.bind.annotation.GetMapping;
5 import org.springframework.web.bind.annotation.PathVariable;
6 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.bind.annotation.RestController;
8
9 import com.tasteprint.account.AuthenticatedUser;
10
11 @RestController
12 class SharingController {
13
14 private final SharingService sharing;
15
16 SharingController(SharingService sharing) {
17 this.sharing = sharing;
18 }
19
20 @GetMapping("/api/v1/public/tasteprints/{shareSlug}")
21 PublicTasteprintView publicTasteprint(@PathVariable String shareSlug) {
22 return sharing.publicTasteprint(shareSlug);
23 }
24
25 @GetMapping("/api/v1/social/compare/{shareSlug}")
26 TasteComparison compare(@AuthenticationPrincipal AuthenticatedUser user,
27 @PathVariable String shareSlug) {
28 return sharing.compare(user.id(), shareSlug);
29 }
30 }
31