c6683b28dc
Release package / release (push) Successful in 17m59s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com> Reviewed-on: #50
33 lines
733 B
Java
33 lines
733 B
Java
package com.drinkool.controller;
|
|
|
|
import com.drinkool.services.FileService;
|
|
import io.smallrye.mutiny.Uni;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.GET;
|
|
import jakarta.ws.rs.POST;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.PathParam;
|
|
import jakarta.ws.rs.core.Response;
|
|
import java.io.File;
|
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
|
import org.jboss.resteasy.reactive.RestForm;
|
|
|
|
@Path("/api/file")
|
|
public class FileController {
|
|
|
|
@Inject
|
|
@RestClient
|
|
FileService fileService;
|
|
|
|
@POST
|
|
public Uni<Response> upload(@RestForm File file) {
|
|
return fileService.upload(file);
|
|
}
|
|
|
|
@GET
|
|
@Path("/{name}")
|
|
public Uni<Response> get(@PathParam("name") String name) {
|
|
return fileService.get(name);
|
|
}
|
|
}
|