feat: club

This commit is contained in:
2024-07-17 10:44:04 +02:00
parent edcda185db
commit d268461bfd
8 changed files with 326 additions and 19 deletions

View File

@@ -24,6 +24,7 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.jwt.JsonWebToken;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
@@ -57,6 +58,14 @@ public class ClubEndpoints {
return clubService.getAll().map(clubModels -> clubModels.stream().map(SimpleClubModel::fromModel).toList());
}
@GET
@Path("/contact_type")
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
public Uni<HashMap<String, String>> getConcatType() {
return Uni.createFrom().item(Contact.toSite());
}
@GET
@Path("/find")
@RolesAllowed({"federation_admin"})
@@ -111,11 +120,12 @@ public class ClubEndpoints {
});
}
@POST
@PUT
@RolesAllowed({"federation_admin"})
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Uni<Long> addAdminClub(FullClubForm input) {
System.out.println(input);
return clubService.add(input)
.invoke(Unchecked.consumer(id -> {
if (id == null) throw new InternalError("Fail to create club data");