[FEAT] update with archidata mongo interface
This commit is contained in:
parent
1cf08390ec
commit
2c0fb99202
@ -1,34 +1,17 @@
|
||||
package org.kar.karusic;
|
||||
|
||||
import org.kar.archidata.db.DbInterfaceMorphia;
|
||||
import org.kar.karusic.model.Album;
|
||||
import org.kar.karusic.model.Artist;
|
||||
import org.kar.karusic.model.Gender;
|
||||
import org.kar.karusic.model.Playlist;
|
||||
import org.kar.karusic.model.Track;
|
||||
|
||||
import com.mongodb.client.MongoClient;
|
||||
import com.mongodb.client.MongoClients;
|
||||
|
||||
import dev.morphia.Datastore;
|
||||
import dev.morphia.Morphia;
|
||||
|
||||
public class MorphiaService {
|
||||
|
||||
private final Datastore datastore;
|
||||
public class MorphiaService extends DbInterfaceMorphia {
|
||||
|
||||
public MorphiaService() {
|
||||
// Connect to MongoDB
|
||||
final MongoClient mongoClient = MongoClients.create("mongodb://root:base_db_password@localhost:27017");
|
||||
this.datastore = Morphia.createDatastore(mongoClient, "karusic");
|
||||
super("mongodb://root:base_db_password@localhost:27017", "karusic", Album.class, Artist.class, Gender.class, Playlist.class, Track.class);
|
||||
|
||||
// Map entities
|
||||
this.datastore.getMapper().map(Album.class, Artist.class, Gender.class, Playlist.class, Track.class);
|
||||
|
||||
// Ensure indexes
|
||||
this.datastore.ensureIndexes();
|
||||
}
|
||||
|
||||
public Datastore getDatastore() {
|
||||
return this.datastore;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.kar.archidata.UpdateJwtPublicKey;
|
||||
import org.kar.archidata.api.DataResource;
|
||||
import org.kar.archidata.api.ProxyResource;
|
||||
import org.kar.archidata.catcher.GenericCatcher;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.filter.CORSFilter;
|
||||
import org.kar.archidata.filter.OptionFilter;
|
||||
import org.kar.archidata.migration.MigrationEngine;
|
||||
@ -45,8 +46,11 @@ public class WebLauncher {
|
||||
protected UpdateJwtPublicKey keyUpdater = null;
|
||||
protected HttpServer server = null;
|
||||
|
||||
private final DataAccess da;
|
||||
|
||||
public WebLauncher() {
|
||||
ConfigBaseVariable.bdDatabase = "karusic";
|
||||
this.da = DataAccess.createInterface();
|
||||
}
|
||||
|
||||
private static URI getBaseURI() {
|
||||
@ -55,7 +59,7 @@ public class WebLauncher {
|
||||
|
||||
public void migrateDB() throws Exception {
|
||||
WebLauncher.LOGGER.info("Create migration engine");
|
||||
final MigrationEngine migrationEngine = new MigrationEngine();
|
||||
final MigrationEngine migrationEngine = new MigrationEngine(this.da);
|
||||
WebLauncher.LOGGER.info("Add initialization");
|
||||
migrationEngine.setInit(new Initialization());
|
||||
WebLauncher.LOGGER.info("Add migration since last version");
|
||||
@ -64,7 +68,7 @@ public class WebLauncher {
|
||||
migrationEngine.add(new Migration20240226());
|
||||
migrationEngine.add(new Migration20240907());
|
||||
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
||||
migrationEngine.migrateWaitAdmin(GlobalConfiguration.dbConfig);
|
||||
migrationEngine.migrateWaitAdmin(GlobalConfiguration.getDbconfig());
|
||||
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
||||
}
|
||||
|
||||
@ -148,7 +152,7 @@ public class WebLauncher {
|
||||
// System.out.println(" getDBLogin: '" + ConfigVariable.getDBLogin() + "'");
|
||||
// System.out.println(" getDBPassword: '" + ConfigVariable.getDBPassword() + "'");
|
||||
// System.out.println(" getDBName: '" + ConfigVariable.getDBName() + "'");
|
||||
System.out.println(" ==> " + GlobalConfiguration.dbConfig);
|
||||
System.out.println(" ==> " + GlobalConfiguration.getDbconfig());
|
||||
System.out.println("OAuth service " + getBaseURI());
|
||||
this.server = GrizzlyHttpServerFactory.createHttpServer(getBaseURI(), rc);
|
||||
final HttpServer serverLink = this.server;
|
||||
|
@ -11,17 +11,13 @@ import org.kar.archidata.annotation.FormDataOptional;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.dataAccess.options.CheckFunction;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.karusic.MorphiaService;
|
||||
import org.kar.karusic.model.Album;
|
||||
import org.kar.karusic.model.Album.AlbumChecker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import dev.morphia.query.Query;
|
||||
import dev.morphia.query.filters.Filters;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
@ -40,24 +36,24 @@ public class AlbumResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AlbumResource.class);
|
||||
static final AlbumChecker CHECKER = new AlbumChecker();
|
||||
|
||||
private final MorphiaService morphiaService = new MorphiaService();
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
@Operation(description = "Get a specific Album with his ID")
|
||||
public Album get(@PathParam("id") final Long id) throws Exception {
|
||||
//return DataAccess.get(Album.class, id);
|
||||
return this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id)).first();
|
||||
return this.da.get(Album.class, id);
|
||||
// return this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id)).first();
|
||||
}
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
@Operation(description = "Get all the available Albums")
|
||||
public List<Album> gets() throws Exception {
|
||||
//return DataAccess.gets(Album.class);
|
||||
final Query<Album> query = this.morphiaService.getDatastore().find(Album.class);
|
||||
return query.stream().toList();
|
||||
return this.da.gets(Album.class);
|
||||
// final Query<Album> query = this.morphiaService.getDatastore().find(Album.class);
|
||||
// return query.stream().toList();
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -66,28 +62,12 @@ public class AlbumResource {
|
||||
@Operation(description = "Add an album (when all the data already exist)")
|
||||
public Album post(final Album data) throws Exception {
|
||||
// TODO: how to manage the checker ???
|
||||
final Album ret = this.morphiaService.getDatastore().save(data);
|
||||
return ret;
|
||||
/*
|
||||
|
||||
final MongoCollection<Track> trackCollection = db.getCollection("TTRACLK", Track.class);
|
||||
|
||||
final InsertOneResult res = trackCollection.insertOne(plop);
|
||||
|
||||
LOGGER.warn("plpop {}", res);
|
||||
|
||||
final ObjectId ploppppp = res.getInsertedId().asObjectId().getValue();
|
||||
|
||||
LOGGER.warn("plpop 2522 {}", res.getInsertedId().asObjectId().getValue());
|
||||
|
||||
final Track ret = trackCollection.find(Filters.eq("_id", res.getInsertedId().asObjectId().getValue()))
|
||||
|
||||
.first();
|
||||
|
||||
System.out.println("Grade found:\t" + ret);
|
||||
|
||||
return DataAccess.insert(data, new CheckFunction(CHECKER));
|
||||
*/
|
||||
// final Album ret = this.morphiaService.getDatastore().save(data);
|
||||
// return ret;
|
||||
/* final MongoCollection<Track> trackCollection = db.getCollection("TTRACLK", Track.class); final InsertOneResult res = trackCollection.insertOne(plop); LOGGER.warn("plpop {}", res); final
|
||||
* ObjectId ploppppp = res.getInsertedId().asObjectId().getValue(); LOGGER.warn("plpop 2522 {}", res.getInsertedId().asObjectId().getValue()); final Track ret =
|
||||
* trackCollection.find(Filters.eq("_id", res.getInsertedId().asObjectId().getValue())) .first(); System.out.println("Grade found:\t" + ret); */
|
||||
return this.da.insert(data, new CheckFunction(CHECKER));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@ -95,77 +75,68 @@ public class AlbumResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Operation(description = "Update a specific album")
|
||||
public Album patch(@PathParam("id") final Long id, @AsyncType(Album.class) final String jsonRequest)
|
||||
throws Exception {
|
||||
// final Query<Album> query = this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id));
|
||||
// final UpdateOperations<Album> ops = this.morphiaService.getDatastore().createUpdateOperations(Album.class)
|
||||
// .set("name", master.getName());
|
||||
// this.morphiaService.getDatastore().update(query, ops);
|
||||
// return Response.ok(master).build();
|
||||
public Album patch(@PathParam("id") final Long id, @AsyncType(Album.class) final String jsonRequest) throws Exception {
|
||||
// final Query<Album> query = this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id));
|
||||
// final UpdateOperations<Album> ops = this.morphiaService.getDatastore().createUpdateOperations(Album.class)
|
||||
// .set("name", master.getName());
|
||||
// this.morphiaService.getDatastore().update(query, ops);
|
||||
// return Response.ok(master).build();
|
||||
|
||||
DataAccess.updateWithJson(Album.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return DataAccess.get(Album.class, id);
|
||||
this.da.updateWithJson(Album.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return this.da.get(Album.class, id);
|
||||
}
|
||||
|
||||
// @PUT
|
||||
// @Path("{id}")
|
||||
// @RolesAllowed("ADMIN")
|
||||
// @Consumes(MediaType.APPLICATION_JSON)
|
||||
// @Operation(description = "Update a specific album")
|
||||
// public Album put(@PathParam("id") final Long id, final Album album)
|
||||
// throws Exception {
|
||||
// final Query<Album> query = this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id));
|
||||
// final UpdateOperations<Album> ops = this.morphiaService.getDatastore().createUpdateOperations(Album.class)
|
||||
// .set("name", album.getName());
|
||||
// this.morphiaService.getDatastore().update(query, ops);
|
||||
// return Response.ok(album).build();
|
||||
// }
|
||||
// @PUT
|
||||
// @Path("{id}")
|
||||
// @RolesAllowed("ADMIN")
|
||||
// @Consumes(MediaType.APPLICATION_JSON)
|
||||
// @Operation(description = "Update a specific album")
|
||||
// public Album put(@PathParam("id") final Long id, final Album album)
|
||||
// throws Exception {
|
||||
// final Query<Album> query = this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id));
|
||||
// final UpdateOperations<Album> ops = this.morphiaService.getDatastore().createUpdateOperations(Album.class)
|
||||
// .set("name", album.getName());
|
||||
// this.morphiaService.getDatastore().update(query, ops);
|
||||
// return Response.ok(album).build();
|
||||
// }
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Operation(description = "Remove a specific album")
|
||||
public void remove(@PathParam("id") final Long id) throws Exception {
|
||||
//DataAccess.delete(Album.class, id);
|
||||
this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id)).delete();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("{id}/track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Operation(description = "Add a Track on a specific album")
|
||||
public Album addTrack(@PathParam("id") final Long id, @PathParam("trackId") final Long trackId) throws Exception {
|
||||
AddOnManyToMany.removeLink(Album.class, id, "track", trackId);
|
||||
return DataAccess.get(Album.class, id);
|
||||
this.da.delete(Album.class, id);
|
||||
// this.morphiaService.getDatastore().find(Album.class).filter(Filters.eq("id", id)).delete();
|
||||
}
|
||||
|
||||
/* @POST
|
||||
* @Path("{id}/track/{trackId}")
|
||||
* @RolesAllowed("ADMIN")
|
||||
* @Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
* @Operation(description = "Add a Track on a specific album") public Album addTrack(@PathParam("id") final Long id, @PathParam("trackId") final Long trackId) throws Exception {
|
||||
* AddOnManyToMany.removeLink(this.dam, Album.class, id, "track", trackId); return this.dam.get(Album.class, id); } */
|
||||
@POST
|
||||
@Path("{id}/cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Operation(description = "Add a cover on a specific album")
|
||||
@TypeScriptProgress
|
||||
public Album uploadCover(
|
||||
@PathParam("id") final Long id,
|
||||
@FormDataOptional @FormDataParam("uri") final String uri,
|
||||
@FormDataOptional @FormDataParam("file") final InputStream fileInputStream,
|
||||
public Album uploadCover(@PathParam("id") final Long id, @FormDataOptional @FormDataParam("uri") final String uri, @FormDataOptional @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataOptional @FormDataParam("file") final FormDataContentDisposition fileMetaData) throws Exception {
|
||||
if (uri != null) {
|
||||
DataTools.uploadCoverFromUri(Album.class, id, uri);
|
||||
DataTools.uploadCoverFromUri(this.da, Album.class, id, uri);
|
||||
} else {
|
||||
DataTools.uploadCover(Album.class, id, fileInputStream, fileMetaData);
|
||||
DataTools.uploadCover(this.da, Album.class, id, fileInputStream, fileMetaData);
|
||||
}
|
||||
return DataAccess.get(Album.class, id);
|
||||
return this.da.get(Album.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Operation(description = "Remove a cover on a specific album")
|
||||
public Album removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId)
|
||||
throws Exception {
|
||||
AddOnDataJson.removeLink(Album.class, id, "covers", coverId);
|
||||
return DataAccess.get(Album.class, id);
|
||||
public Album removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId) throws Exception {
|
||||
AddOnDataJson.removeLink(this.da, Album.class, id, "covers", coverId);
|
||||
return this.da.get(Album.class, id);
|
||||
}
|
||||
}
|
||||
|
@ -34,25 +34,26 @@ import jakarta.ws.rs.core.MediaType;
|
||||
public class ArtistResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ArtistResource.class);
|
||||
static final ArtistChecker CHECKER = new ArtistChecker();
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Artist get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Artist.class, id);
|
||||
public Artist get(@PathParam("id") final Long id) throws Exception {
|
||||
return this.da.get(Artist.class, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Artist> gets() throws Exception {
|
||||
return DataAccess.gets(Artist.class);
|
||||
return this.da.gets(Artist.class);
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Artist post(final Artist data) throws Exception {
|
||||
return DataAccess.insert(data, new CheckFunction(CHECKER));
|
||||
return this.da.insert(data, new CheckFunction(CHECKER));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@ -60,15 +61,15 @@ public class ArtistResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Artist patch(@PathParam("id") final Long id, @AsyncType(Artist.class) final String jsonRequest) throws Exception {
|
||||
DataAccess.updateWithJson(Artist.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return DataAccess.get(Artist.class, id);
|
||||
this.da.updateWithJson(Artist.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return this.da.get(Artist.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public void remove(@PathParam("id") final Long id) throws Exception {
|
||||
DataAccess.delete(Artist.class, id);
|
||||
this.da.delete(Artist.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -79,11 +80,11 @@ public class ArtistResource {
|
||||
public Artist uploadCover(@PathParam("id") final Long id, @FormDataOptional @FormDataParam("uri") final String uri, @FormDataOptional @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataOptional @FormDataParam("file") final FormDataContentDisposition fileMetaData) throws Exception {
|
||||
if (uri != null) {
|
||||
DataTools.uploadCoverFromUri(Artist.class, id, uri);
|
||||
DataTools.uploadCoverFromUri(this.da, Artist.class, id, uri);
|
||||
} else {
|
||||
DataTools.uploadCover(Artist.class, id, fileInputStream, fileMetaData);
|
||||
DataTools.uploadCover(this.da, Artist.class, id, fileInputStream, fileMetaData);
|
||||
}
|
||||
return DataAccess.get(Artist.class, id);
|
||||
return this.da.get(Artist.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@ -91,7 +92,7 @@ public class ArtistResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
public Artist removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId) throws Exception {
|
||||
LOGGER.error("klmlmkmlkmlklmklmk");
|
||||
AddOnDataJson.removeLink(Artist.class, id, "covers", coverId);
|
||||
return DataAccess.get(Artist.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Artist.class, id, "covers", coverId);
|
||||
return this.da.get(Artist.class, id);
|
||||
}
|
||||
}
|
||||
|
@ -34,25 +34,26 @@ import jakarta.ws.rs.core.MediaType;
|
||||
public class GenderResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GenderResource.class);
|
||||
static final GenderChecker CHECKER = new GenderChecker();
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Gender get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Gender.class, id);
|
||||
public Gender get(@PathParam("id") final Long id) throws Exception {
|
||||
return this.da.get(Gender.class, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Gender> gets() throws Exception {
|
||||
return DataAccess.gets(Gender.class);
|
||||
return this.da.gets(Gender.class);
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Gender post(final Gender data) throws Exception {
|
||||
return DataAccess.insert(data, new CheckFunction(CHECKER));
|
||||
return this.da.insert(data, new CheckFunction(CHECKER));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@ -60,15 +61,15 @@ public class GenderResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Gender patch(@PathParam("id") final Long id, @AsyncType(Gender.class) final String jsonRequest) throws Exception {
|
||||
DataAccess.updateWithJson(Gender.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return DataAccess.get(Gender.class, id);
|
||||
this.da.updateWithJson(Gender.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return this.da.get(Gender.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public void remove(@PathParam("id") final Long id) throws Exception {
|
||||
DataAccess.delete(Gender.class, id);
|
||||
this.da.delete(Gender.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -79,18 +80,18 @@ public class GenderResource {
|
||||
public Gender uploadCover(@PathParam("id") final Long id, @FormDataOptional @FormDataParam("uri") final String uri, @FormDataOptional @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataOptional @FormDataParam("file") final FormDataContentDisposition fileMetaData) throws Exception {
|
||||
if (uri != null) {
|
||||
DataTools.uploadCoverFromUri(Gender.class, id, uri);
|
||||
DataTools.uploadCoverFromUri(this.da, Gender.class, id, uri);
|
||||
} else {
|
||||
DataTools.uploadCover(Gender.class, id, fileInputStream, fileMetaData);
|
||||
DataTools.uploadCover(this.da, Gender.class, id, fileInputStream, fileMetaData);
|
||||
}
|
||||
return DataAccess.get(Gender.class, id);
|
||||
return this.da.get(Gender.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public Gender removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId) throws Exception {
|
||||
AddOnDataJson.removeLink(Gender.class, id, "covers", coverId);
|
||||
return DataAccess.get(Gender.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Gender.class, id, "covers", coverId);
|
||||
return this.da.get(Gender.class, id);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.annotation.AsyncType;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.dataAccess.options.CheckFunction;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
import org.kar.karusic.model.Playlist;
|
||||
@ -33,25 +32,26 @@ import jakarta.ws.rs.core.MediaType;
|
||||
public class PlaylistResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlaylistResource.class);
|
||||
static final TrackChecker CHECKER = new TrackChecker();
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Playlist get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
public Playlist get(@PathParam("id") final Long id) throws Exception {
|
||||
return this.da.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Playlist> gets() throws Exception {
|
||||
return DataAccess.gets(Playlist.class);
|
||||
return this.da.gets(Playlist.class);
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Playlist post(final Playlist data) throws Exception {
|
||||
return DataAccess.insert(data, new CheckFunction(CHECKER));
|
||||
return this.da.insert(data, new CheckFunction(CHECKER));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@ -59,15 +59,15 @@ public class PlaylistResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Playlist patch(@PathParam("id") final Long id, @AsyncType(Playlist.class) final String jsonRequest) throws Exception {
|
||||
DataAccess.updateWithJson(Playlist.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
this.da.updateWithJson(Playlist.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return this.da.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public void remove(@PathParam("id") final Long id) throws Exception {
|
||||
DataAccess.delete(Playlist.class, id);
|
||||
this.da.delete(Playlist.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -75,16 +75,16 @@ public class PlaylistResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
public Playlist addTrack(@PathParam("id") final Long id, @PathParam("trackId") final Long trackId) throws Exception {
|
||||
AddOnManyToMany.removeLink(Playlist.class, id, "track", trackId);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Playlist.class, id, "track", trackId);
|
||||
return this.da.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public Playlist removeTrack(@PathParam("id") final Long id, @PathParam("trackId") final Long trackId) throws Exception {
|
||||
AddOnManyToMany.removeLink(Playlist.class, id, "track", trackId);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Playlist.class, id, "track", trackId);
|
||||
return this.da.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -94,14 +94,14 @@ public class PlaylistResource {
|
||||
@AsyncType(Playlist.class)
|
||||
public void uploadCover(@PathParam("id") final Long id, @FormDataParam("file") final InputStream fileInputStream, @FormDataParam("file") final FormDataContentDisposition fileMetaData)
|
||||
throws Exception {
|
||||
DataTools.uploadCover(Playlist.class, id, fileInputStream, fileMetaData);
|
||||
DataTools.uploadCover(this.da, Playlist.class, id, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public Playlist removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId) throws Exception {
|
||||
AddOnDataJson.removeLink(Playlist.class, id, "covers", coverId);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Playlist.class, id, "covers", coverId);
|
||||
return this.da.get(Playlist.class, id);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import org.kar.archidata.annotation.FormDataOptional;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
import org.kar.archidata.dataAccess.options.CheckFunction;
|
||||
import org.kar.archidata.model.Data;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
@ -40,25 +39,26 @@ import jakarta.ws.rs.core.Response;
|
||||
public class TrackResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TrackResource.class);
|
||||
static final TrackChecker CHECKER = new TrackChecker();
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Track get(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Track.class, id);
|
||||
public Track get(@PathParam("id") final Long id) throws Exception {
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Track> gets() throws Exception {
|
||||
return DataAccess.gets(Track.class);
|
||||
return this.da.gets(Track.class);
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Track post(final Track data) throws Exception {
|
||||
return DataAccess.insert(data, new CheckFunction(CHECKER));
|
||||
return this.da.insert(data, new CheckFunction(CHECKER));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@ -66,15 +66,15 @@ public class TrackResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Track patch(@PathParam("id") final Long id, @AsyncType(Track.class) final String jsonRequest) throws Exception {
|
||||
DataAccess.updateWithJson(Track.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return DataAccess.get(Track.class, id);
|
||||
this.da.updateWithJson(Track.class, id, jsonRequest, new CheckFunction(CHECKER));
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public void remove(@PathParam("id") final Long id) throws Exception {
|
||||
DataAccess.delete(Track.class, id);
|
||||
this.da.delete(Track.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -82,16 +82,16 @@ public class TrackResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
public Track addTrack(@PathParam("id") final Long id, @PathParam("artistId") final Long artistId) throws Exception {
|
||||
AddOnManyToMany.removeLink(Track.class, id, "artist", artistId);
|
||||
return DataAccess.get(Track.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Track.class, id, "artist", artistId);
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/artist/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public Track removeTrack(@PathParam("id") final Long id, @PathParam("artistId") final Long artistId) throws Exception {
|
||||
AddOnManyToMany.removeLink(Track.class, id, "artist", artistId);
|
||||
return DataAccess.get(Track.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Track.class, id, "artist", artistId);
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -102,19 +102,19 @@ public class TrackResource {
|
||||
public Track uploadCover(@PathParam("id") final Long id, @FormDataParam("uri") final String uri, @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) throws Exception {
|
||||
if (uri != null) {
|
||||
DataTools.uploadCoverFromUri(Track.class, id, uri);
|
||||
DataTools.uploadCoverFromUri(this.da, Track.class, id, uri);
|
||||
} else {
|
||||
DataTools.uploadCover(Track.class, id, fileInputStream, fileMetaData);
|
||||
DataTools.uploadCover(this.da, Track.class, id, fileInputStream, fileMetaData);
|
||||
}
|
||||
return DataAccess.get(Track.class, id);
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}/cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
public Track removeCover(@PathParam("id") final Long id, @PathParam("coverId") final UUID coverId) throws Exception {
|
||||
AddOnDataJson.removeLink(Track.class, id, "covers", coverId);
|
||||
return DataAccess.get(Track.class, id);
|
||||
AddOnDataJson.removeLink(this.da, Track.class, id, "covers", coverId);
|
||||
return this.da.get(Track.class, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@ -153,12 +153,12 @@ public class TrackResource {
|
||||
|
||||
final long tmpUID = DataTools.getTmpDataId();
|
||||
final String sha512 = DataTools.saveTemporaryFile(fileInputStream, tmpUID);
|
||||
Data data = DataTools.getWithSha512(sha512);
|
||||
Data data = DataTools.getWithSha512(this.da, sha512);
|
||||
if (data == null) {
|
||||
LOGGER.info("Need to add the data in the BDD ... ");
|
||||
|
||||
try {
|
||||
data = DataTools.createNewData(tmpUID, fileMetaData.getFileName(), sha512);
|
||||
data = DataTools.createNewData(this.da, tmpUID, fileMetaData.getFileName(), sha512);
|
||||
} catch (final IOException ex) {
|
||||
DataTools.removeTemporaryFile(tmpUID);
|
||||
ex.printStackTrace();
|
||||
@ -170,7 +170,7 @@ public class TrackResource {
|
||||
}
|
||||
} else if (data.deleted) {
|
||||
LOGGER.info("Data already exist but deleted");
|
||||
DataTools.undelete(data.uuid);
|
||||
DataTools.undelete(this.da, data.uuid);
|
||||
data.deleted = false;
|
||||
} else {
|
||||
LOGGER.info("Data already exist ... all good");
|
||||
@ -188,8 +188,8 @@ public class TrackResource {
|
||||
trackElem.artists = new ArrayList<>();
|
||||
trackElem.artists.add(artistId != null ? Long.parseLong(artistId) : null);
|
||||
}
|
||||
trackElem = DataAccess.insert(trackElem, new CheckFunction(CHECKER));
|
||||
/* Old mode of artist insertion (removed due to the slowlest request of getting value if (artistElem != null) { DataAccess.addLink(Track.class, trackElem.id, "artist", artistElem.id); } */
|
||||
trackElem = this.da.insert(trackElem, new CheckFunction(CHECKER));
|
||||
/* Old mode of artist insertion (removed due to the slowlest request of getting value if (artistElem != null) { this.dam.addLink(Track.class, trackElem.id, "artist", artistElem.id); } */
|
||||
return Response.ok(trackElem).build();
|
||||
} catch (final Exception ex) {
|
||||
LOGGER.info("Catch an unexpected error ... {}", ex.getMessage());
|
||||
|
@ -26,6 +26,7 @@ import jakarta.ws.rs.core.SecurityContext;
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public class UserResource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(UserResource.class);
|
||||
private final DataAccess da = DataAccess.createInterface();
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class UserOut {
|
||||
@ -47,7 +48,7 @@ public class UserResource {
|
||||
public List<UserKarusic> gets() {
|
||||
LOGGER.info("getUsers");
|
||||
try {
|
||||
return DataAccess.gets(UserKarusic.class);
|
||||
return this.da.gets(UserKarusic.class);
|
||||
} catch (final Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
@ -66,7 +67,7 @@ public class UserResource {
|
||||
LOGGER.info("== USER {} ", gc.userByToken.name);
|
||||
LOGGER.info("===================================================");
|
||||
try {
|
||||
return DataAccess.get(UserKarusic.class, userId);
|
||||
return this.da.get(UserKarusic.class, userId);
|
||||
} catch (final Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
@ -35,35 +35,35 @@ public class Initialization extends MigrationSqlStep {
|
||||
addClass(elem);
|
||||
}
|
||||
|
||||
addAction("""
|
||||
INSERT INTO `gender` (`id`, `name`, `description`) VALUES
|
||||
(1, 'Variété française', NULL),
|
||||
(2, 'Pop', NULL),
|
||||
(3, 'inconnue', NULL),
|
||||
(4, 'Disco', NULL),
|
||||
(5, 'Enfants', NULL),
|
||||
(6, 'Portugaise', NULL),
|
||||
(7, 'Apprentissage', NULL),
|
||||
(8, 'Blues', NULL),
|
||||
(9, 'Jazz', NULL),
|
||||
(10, 'Chanson Noël', NULL),
|
||||
(11, 'DubStep', NULL),
|
||||
(12, 'Rap français', NULL),
|
||||
(13, 'Classique', NULL),
|
||||
(14, 'Rock', NULL),
|
||||
(15, 'Electro', NULL),
|
||||
(16, 'Celtique', NULL),
|
||||
(17, 'Country', NULL),
|
||||
(18, 'Variété Québéquoise', NULL),
|
||||
(19, 'Médiéval', NULL),
|
||||
(20, 'Variété Italienne', NULL),
|
||||
(21, 'Comédie Musicale', NULL),
|
||||
(22, 'Vianney', NULL),
|
||||
(23, 'Bande Original', NULL),
|
||||
(24, 'Bande Originale', NULL),
|
||||
(25, 'Variété Belge', NULL),
|
||||
(26, 'Gospel', NULL);
|
||||
""");
|
||||
addAction((final DataAccess da) -> {
|
||||
final List<Gender> data = List.of(//
|
||||
new Gender(1L, "Variété française"), //
|
||||
new Gender(2L, "Pop"), //
|
||||
new Gender(3L, "inconnue"), //
|
||||
new Gender(4L, "Disco"), //
|
||||
new Gender(5L, "Enfants"), //
|
||||
new Gender(6L, "Portugaise"), //
|
||||
new Gender(7L, "Apprentissage"), //
|
||||
new Gender(8L, "Blues"), //
|
||||
new Gender(9L, "Jazz"), //
|
||||
new Gender(10L, "Chanson Noël"), //
|
||||
new Gender(11L, "DubStep"), //
|
||||
new Gender(12L, "Rap français"), //
|
||||
new Gender(13L, "Classique"), //
|
||||
new Gender(14L, "Rock"), //
|
||||
new Gender(15L, "Electro"), //
|
||||
new Gender(16L, "Celtique"), //
|
||||
new Gender(17L, "Country"), //
|
||||
new Gender(18L, "Variété Québéquoise"), //
|
||||
new Gender(19L, "Médiéval"), //
|
||||
new Gender(20L, "Variété Italienne"), //
|
||||
new Gender(21L, "Comédie Musicale"), //
|
||||
new Gender(22L, "Vianney"), //
|
||||
new Gender(23L, "Bande Original"), //
|
||||
new Gender(24L, "Bande Originale"), //
|
||||
new Gender(25L, "Variété Belge"), //
|
||||
new Gender(26L, "Gospel"));
|
||||
});
|
||||
// set start increment element to permit to add after default elements
|
||||
addAction("""
|
||||
ALTER TABLE `album` AUTO_INCREMENT = 1000;
|
||||
@ -85,10 +85,10 @@ public class Initialization extends MigrationSqlStep {
|
||||
""", "mysql");
|
||||
}
|
||||
|
||||
public static void dropAll() {
|
||||
public static void dropAll(final DataAccess da) {
|
||||
for (final Class<?> element : CLASSES_BASE) {
|
||||
try {
|
||||
DataAccess.drop(element);
|
||||
da.drop(element);
|
||||
} catch (final Exception ex) {
|
||||
LOGGER.error("Fail to drop table !!!!!!");
|
||||
ex.printStackTrace();
|
||||
@ -96,10 +96,10 @@ public class Initialization extends MigrationSqlStep {
|
||||
}
|
||||
}
|
||||
|
||||
public static void cleanAll() {
|
||||
public static void cleanAll(final DataAccess da) {
|
||||
for (final Class<?> element : CLASSES_BASE) {
|
||||
try {
|
||||
DataAccess.cleanAll(element);
|
||||
da.cleanAll(element);
|
||||
} catch (final Exception ex) {
|
||||
LOGGER.error("Fail to clean table !!!!!!");
|
||||
ex.printStackTrace();
|
||||
|
@ -12,11 +12,13 @@ import org.kar.archidata.model.GenericDataSoftDelete;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity("Album")
|
||||
@Table(name = "album")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
|
@ -12,11 +12,13 @@ import org.kar.archidata.model.GenericDataSoftDelete;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity("Artist")
|
||||
@Table(name = "artist")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
|
@ -23,11 +23,13 @@ import org.kar.archidata.model.GenericDataSoftDelete;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity("Gender")
|
||||
@Table(name = "gender")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ -47,4 +49,11 @@ public class Gender extends GenericDataSoftDelete {
|
||||
@Nullable
|
||||
public List<UUID> covers = null;
|
||||
|
||||
public Gender() {}
|
||||
|
||||
public Gender(final Long id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.kar.archidata.model.GenericDataSoftDelete;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Column;
|
||||
@ -30,6 +31,7 @@ import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity("Playlist")
|
||||
@Table(name = "playlist")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
|
@ -23,11 +23,13 @@ import org.kar.archidata.model.GenericDataSoftDelete;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity("Track")
|
||||
@Table(name = "track")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
|
@ -3,12 +3,14 @@
|
||||
# Default logging detail level for all instances of SimpleLogger.
|
||||
# Must be one of ("trace", "debug", "info", "warn", or "error").
|
||||
# If not specified, defaults to "info".
|
||||
org.slf4j.simpleLogger.defaultLogLevel=trace
|
||||
org.slf4j.simpleLogger.defaultLogLevel=INFO
|
||||
|
||||
# Logging detail level for a SimpleLogger instance named "xxxxx".
|
||||
# Must be one of ("trace", "debug", "info", "warn", or "error").
|
||||
# If not specified, the default logging detail level is used.
|
||||
#org.slf4j.simpleLogger.log.xxxxx=
|
||||
org.slf4j.simpleLogger.log.org.kar.archidata=TRACE
|
||||
org.slf4j.simpleLogger.log.org.kar.karusic=TRACE
|
||||
|
||||
# Set to true if you want the current date and time to be included in output messages.
|
||||
# Default is false, and will output the number of milliseconds elapsed since startup.
|
||||
|
@ -7,7 +7,6 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
import org.kar.archidata.tools.ConfigBaseVariable;
|
||||
import org.kar.archidata.tools.RESTApi;
|
||||
import org.kar.karusic.migration.Initialization;
|
||||
|
@ -27,19 +27,6 @@ services:
|
||||
volumes:
|
||||
- ./dataMongo:/data/db
|
||||
|
||||
mongo_express_service:
|
||||
image: mongo-express
|
||||
restart: always
|
||||
ports:
|
||||
- 8081:8081
|
||||
links:
|
||||
- kar_mongodb_service:db
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: base_db_password
|
||||
ME_CONFIG_MONGODB_URL: mongodb://root:base_db_password@db:27017/
|
||||
ME_CONFIG_BASICAUTH: false
|
||||
|
||||
kar_adminer_service:
|
||||
image: adminer:latest
|
||||
restart: always
|
||||
@ -52,3 +39,17 @@ services:
|
||||
ports:
|
||||
- 4079:8080
|
||||
mem_limit: 50m
|
||||
|
||||
mongo_express_service:
|
||||
image: mongo-express
|
||||
restart: always
|
||||
ports:
|
||||
- 4077:8081
|
||||
links:
|
||||
- kar_mongodb_service:db
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: base_db_password
|
||||
ME_CONFIG_MONGODB_URL: mongodb://root:base_db_password@db:27017/
|
||||
ME_CONFIG_BASICAUTH: false
|
||||
|
||||
|
@ -192,30 +192,6 @@ export namespace AlbumResource {
|
||||
params,
|
||||
}, isAlbum);
|
||||
};
|
||||
/**
|
||||
* Remove a Track on a specific album
|
||||
*/
|
||||
export function removeTrack({
|
||||
restConfig,
|
||||
params,
|
||||
}: {
|
||||
restConfig: RESTConfig,
|
||||
params: {
|
||||
trackId: Long,
|
||||
id: Long,
|
||||
},
|
||||
}): Promise<Album> {
|
||||
return RESTRequestJson({
|
||||
restModel: {
|
||||
endPoint: "/album/{id}/track/{trackId}",
|
||||
requestType: HTTPRequestModel.DELETE,
|
||||
contentType: HTTPMimeType.TEXT_PLAIN,
|
||||
accept: HTTPMimeType.JSON,
|
||||
},
|
||||
restConfig,
|
||||
params,
|
||||
}, isAlbum);
|
||||
};
|
||||
/**
|
||||
* Add a cover on a specific album
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user