[DEV] update new archidata

This commit is contained in:
Edouard DUPIN 2024-01-17 20:21:02 +01:00
parent 0383be3ada
commit d2128fcac8
7 changed files with 18 additions and 14 deletions

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>

View File

@ -1,8 +1,8 @@
package org.kar.karideo.api;
import org.kar.archidata.exception.FailException;
import org.kar.archidata.util.ConfigBaseVariable;
import org.kar.archidata.util.JWTWrapper;
import org.kar.archidata.tools.ConfigBaseVariable;
import org.kar.archidata.tools.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 {

View File

@ -9,7 +9,8 @@ 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.util.DataTools;
import org.kar.archidata.dataAccess.options.Condition;
import org.kar.archidata.tools.DataTools;
import org.kar.karideo.model.Season;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -99,7 +100,7 @@ public class SeasonResource {
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)));
Season out = DataAccess.getWhere(Season.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", seriesId))));
if (out == null) {
out = new Season();
out.name = name;

View File

@ -9,7 +9,8 @@ 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.util.DataTools;
import org.kar.archidata.dataAccess.options.Condition;
import org.kar.archidata.tools.DataTools;
import org.kar.karideo.model.Series;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -99,7 +100,7 @@ public class SeriesResource {
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)));
Series out = DataAccess.getWhere(Series.class, new Condition(new QueryAnd(new QueryCondition("name", "=", name), new QueryCondition("parentId", "=", typeId))));
if (out == null) {
out = new Series();
out.name = name;

View File

@ -8,7 +8,8 @@ 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.util.DataTools;
import org.kar.archidata.dataAccess.options.Condition;
import org.kar.archidata.tools.DataTools;
import org.kar.karideo.model.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -102,7 +103,7 @@ public class TypeResource {
public static Type getOrCreate(final String name) {
try {
Type out = DataAccess.getWhere(Type.class, new QueryCondition("name", "=", name));
Type out = DataAccess.getWhere(Type.class, new Condition(new QueryCondition("name", "=", name)));
if (out == null) {
out = new Type();
out.name = name;

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.kar.archidata.dataAccess.DataAccess;
import org.kar.archidata.dataAccess.QueryAnd;
import org.kar.archidata.dataAccess.QueryCondition;
import org.kar.archidata.dataAccess.options.Condition;
import org.kar.archidata.filter.GenericContext;
import org.kar.karideo.model.UserMediaAdvancement;
import org.slf4j.Logger;
@ -33,14 +34,14 @@ public class UserMediaAdvancementResource {
@RolesAllowed("USER")
public UserMediaAdvancement getWithId(@Context final SecurityContext sc, @PathParam("id") final Long id) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
return DataAccess.getWhere(UserMediaAdvancement.class, new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id)));
return DataAccess.getWhere(UserMediaAdvancement.class, new Condition(new QueryAnd(new QueryCondition("mediaId", "=", id), new QueryCondition("userId", "=", gc.userByToken.id))));
}
@GET
@RolesAllowed("USER")
public List<UserMediaAdvancement> gets(@Context final SecurityContext sc) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
return DataAccess.getsWhere(UserMediaAdvancement.class, new QueryCondition("userId", "=", gc.userByToken.id));
return DataAccess.getsWhere(UserMediaAdvancement.class, new Condition(new QueryCondition("userId", "=", gc.userByToken.id)));
}
/* =============================================================================

View File

@ -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.util.DataTools;
import org.kar.archidata.tools.DataTools;
import org.kar.karideo.model.Media;
import org.kar.karideo.model.Season;
import org.kar.karideo.model.Series;