[DEV] update version
This commit is contained in:
parent
4b20edc04d
commit
0383be3ada
@ -20,12 +20,12 @@
|
||||
<dependency>
|
||||
<groupId>kangaroo-and-rabbit</groupId>
|
||||
<artifactId>archidata</artifactId>
|
||||
<version>0.4.0</version>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
<!--
|
||||
************************************************************
|
||||
@ -35,13 +35,13 @@
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.10.0</version>
|
||||
<version>5.10.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.10.0</version>
|
||||
<version>5.10.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.kar.karideo.api;
|
||||
|
||||
import org.kar.archidata.exception.FailException;
|
||||
import org.kar.archidata.tools.ConfigBaseVariable;
|
||||
import org.kar.archidata.tools.JWTWrapper;
|
||||
import org.kar.archidata.util.ConfigBaseVariable;
|
||||
import org.kar.archidata.util.JWTWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -17,10 +17,10 @@ import jakarta.ws.rs.core.Response;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public class HealthCheck {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(HealthCheck.class);
|
||||
|
||||
|
||||
public record HealthResult(
|
||||
String value) {};
|
||||
|
||||
|
||||
@GET
|
||||
@PermitAll
|
||||
public HealthResult getHealth() throws FailException {
|
||||
|
@ -9,7 +9,7 @@ import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.QueryAnd;
|
||||
import org.kar.archidata.dataAccess.QueryCondition;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.archidata.util.DataTools;
|
||||
import org.kar.karideo.model.Season;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -30,20 +30,20 @@ import jakarta.ws.rs.core.Response;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class SeasonResource {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(SeasonResource.class);
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Season getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Season.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Season> get() throws Exception {
|
||||
return DataAccess.gets(Season.class);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
@ -51,18 +51,18 @@ public class SeasonResource {
|
||||
public Season get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Season.class, id);
|
||||
}
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
* ADMIN SECTION:
|
||||
* ============================================================================= */
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Season put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Season.class, jsonRequest);
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class SeasonResource {
|
||||
DataAccess.updateWithJson(Season.class, id, jsonRequest);
|
||||
return DataAccess.get(Season.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -79,7 +79,7 @@ public class SeasonResource {
|
||||
DataAccess.delete(Season.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -88,7 +88,7 @@ public class SeasonResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Season.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -96,7 +96,7 @@ public class SeasonResource {
|
||||
AddOnManyToMany.removeLink(Season.class, id, "cover", coverId);
|
||||
return Response.ok(DataAccess.get(Season.class, id)).build();
|
||||
}
|
||||
|
||||
|
||||
public static Season getOrCreate(final String name, final Long seriesId) {
|
||||
try {
|
||||
Season out = DataAccess.getWhere(Season.class, new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId)));
|
||||
@ -113,5 +113,5 @@ public class SeasonResource {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.QueryAnd;
|
||||
import org.kar.archidata.dataAccess.QueryCondition;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.archidata.util.DataTools;
|
||||
import org.kar.karideo.model.Series;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -30,20 +30,20 @@ import jakarta.ws.rs.core.Response;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class SeriesResource {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(SeriesResource.class);
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Series getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Series.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Series> get() throws Exception {
|
||||
return DataAccess.gets(Series.class);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
@ -51,18 +51,18 @@ public class SeriesResource {
|
||||
public Series get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Series.class, id);
|
||||
}
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
* ADMIN SECTION:
|
||||
* ============================================================================= */
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Series put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Series.class, jsonRequest);
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class SeriesResource {
|
||||
DataAccess.updateWithJson(Series.class, id, jsonRequest);
|
||||
return DataAccess.get(Series.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -79,7 +79,7 @@ public class SeriesResource {
|
||||
DataAccess.delete(Series.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -88,7 +88,7 @@ public class SeriesResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Series.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -96,7 +96,7 @@ public class SeriesResource {
|
||||
AddOnManyToMany.removeLink(Series.class, id, "cover", coverId);
|
||||
return Response.ok(DataAccess.get(Series.class, id)).build();
|
||||
}
|
||||
|
||||
|
||||
public static Series getOrCreate(final String name, final Long typeId) {
|
||||
try {
|
||||
Series out = DataAccess.getWhere(Series.class, new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId)));
|
||||
@ -113,5 +113,5 @@ public class SeriesResource {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.QueryCondition;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.archidata.util.DataTools;
|
||||
import org.kar.karideo.model.Type;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -29,20 +29,20 @@ import jakarta.ws.rs.core.Response;
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
|
||||
public class TypeResource {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(TypeResource.class);
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Type getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Type.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Type> get() throws Exception {
|
||||
return DataAccess.gets(Type.class);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
@ -50,22 +50,22 @@ public class TypeResource {
|
||||
public Type get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Type.class, id);
|
||||
}
|
||||
|
||||
|
||||
public static Type getId(final Long id) throws Exception {
|
||||
return DataAccess.get(Type.class, id);
|
||||
}
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
* ADMIN SECTION:
|
||||
* ============================================================================= */
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Type put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Type.class, jsonRequest);
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -74,7 +74,7 @@ public class TypeResource {
|
||||
DataAccess.updateWithJson(Type.class, id, jsonRequest);
|
||||
return DataAccess.get(Type.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -82,7 +82,7 @@ public class TypeResource {
|
||||
DataAccess.delete(Type.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -91,7 +91,7 @@ public class TypeResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Type.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -99,7 +99,7 @@ public class TypeResource {
|
||||
AddOnManyToMany.removeLink(Type.class, id, "cover", coverId);
|
||||
return Response.ok(DataAccess.get(Type.class, id)).build();
|
||||
}
|
||||
|
||||
|
||||
public static Type getOrCreate(final String name) {
|
||||
try {
|
||||
Type out = DataAccess.getWhere(Type.class, new QueryCondition("name", "=", name));
|
||||
@ -115,5 +115,5 @@ public class TypeResource {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.exception.FailException;
|
||||
import org.kar.archidata.exception.InputException;
|
||||
import org.kar.archidata.model.Data;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.archidata.util.DataTools;
|
||||
import org.kar.karideo.model.Media;
|
||||
import org.kar.karideo.model.Season;
|
||||
import org.kar.karideo.model.Series;
|
||||
@ -37,20 +37,20 @@ import jakarta.ws.rs.core.Response;
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class VideoResource {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(VideoResource.class);
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Media> get() throws Exception {
|
||||
return DataAccess.gets(Media.class);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public Media get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Media.class, id);
|
||||
}
|
||||
|
||||
|
||||
@PUT
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -60,7 +60,7 @@ public class VideoResource {
|
||||
DataAccess.updateWithJson(Media.class, id, jsonRequest);
|
||||
return DataAccess.get(Media.class, id);
|
||||
}
|
||||
|
||||
|
||||
private String multipartCorrection(final String data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
@ -73,7 +73,7 @@ public class VideoResource {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/upload/")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -91,7 +91,7 @@ public class VideoResource {
|
||||
episode = multipartCorrection(episode);
|
||||
title = multipartCorrection(title);
|
||||
typeId = multipartCorrection(typeId);
|
||||
|
||||
|
||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||
System.out.println("Upload media file: " + fileMetaData);
|
||||
System.out.println(" - fileName: " + fileName);
|
||||
@ -107,7 +107,7 @@ public class VideoResource {
|
||||
if (typeId == null) {
|
||||
throw new InputException("typeId", "TypiId is not specified");
|
||||
}
|
||||
|
||||
|
||||
final long tmpUID = DataResource.getTmpDataId();
|
||||
final String sha512 = DataResource.saveTemporaryFile(fileInputStream, tmpUID);
|
||||
Data data = DataResource.getWithSha512(sha512);
|
||||
@ -145,7 +145,7 @@ public class VideoResource {
|
||||
if (series != null) {
|
||||
seriesNode = SeriesResource.getOrCreate(series, typeNode.id);
|
||||
}
|
||||
|
||||
|
||||
System.out.println(" ==> " + seriesNode);
|
||||
System.out.println("Find seasonNode");
|
||||
// get uid of season:
|
||||
@ -157,10 +157,10 @@ public class VideoResource {
|
||||
if (season != null) {
|
||||
seasonNode = SeasonResource.getOrCreate(season, seriesNode.id);
|
||||
}
|
||||
|
||||
|
||||
System.out.println(" ==> " + seasonNode);
|
||||
System.out.println("add media");
|
||||
|
||||
|
||||
final long uniqueSQLID = -1;
|
||||
try {
|
||||
final Media media = new Media();
|
||||
@ -195,7 +195,7 @@ public class VideoResource {
|
||||
throw new FailException("Catch Exception ==> check server logs");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -204,7 +204,7 @@ public class VideoResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Media.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -212,7 +212,7 @@ public class VideoResource {
|
||||
AddOnManyToMany.removeLink(Media.class, id, "cover", coverId);
|
||||
return Response.ok(DataAccess.get(Media.class, id)).build();
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
|
@ -5,7 +5,6 @@ import java.util.Map;
|
||||
import org.kar.archidata.tools.JWTWrapper;
|
||||
|
||||
public class Common {
|
||||
static String userToken = JWTWrapper.createJwtTestToken(16512, "test_user_login", "KarAuth", "karideo", Map.of("USER", Boolean.TRUE));
|
||||
static String adminToken = JWTWrapper.createJwtTestToken(16512, "test_admin_login", "KarAuth", "karideo", Map.of("USER", Boolean.TRUE, "ADMIN", Boolean.TRUE));
|
||||
|
||||
static String USER_TOKEN = JWTWrapper.createJwtTestToken(16512, "test_user_login", "KarAuth", "karideo", Map.of("karideo", Map.of("USER", Boolean.TRUE)));
|
||||
static String ADMIN_TOKEN = JWTWrapper.createJwtTestToken(16512, "test_admin_login", "KarAuth", "karideo", Map.of("karideo", Map.of("USER", Boolean.TRUE, "ADMIN", Boolean.TRUE)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user