forked from SteamWar/SteamWar
Merge branch 'main' into TNTLeague/TeamsOnSameLine
This commit is contained in:
@@ -64,7 +64,7 @@ public class Event {
|
||||
}
|
||||
|
||||
public static Event create(String eventName, Timestamp start, Timestamp end){
|
||||
return get(create.insertGetKey(eventName, start, start, end, 5, false, false));
|
||||
return get(create.insertGetKey(eventName, start, start, end, 5, false));
|
||||
}
|
||||
|
||||
public static Event get(int eventID){
|
||||
|
||||
@@ -65,6 +65,10 @@ public class NodeData {
|
||||
private SchematicFormat nodeFormat;
|
||||
|
||||
public InputStream schemData() throws IOException {
|
||||
return schemData(true);
|
||||
}
|
||||
|
||||
public InputStream schemData(boolean decompress) throws IOException {
|
||||
try {
|
||||
return selSchemData.select(rs -> {
|
||||
rs.next();
|
||||
@@ -73,7 +77,11 @@ public class NodeData {
|
||||
if(rs.wasNull() || schemData.available() == 0) {
|
||||
throw new SecurityException("SchemData is null");
|
||||
}
|
||||
return new GZIPInputStream(schemData);
|
||||
if (decompress) {
|
||||
return new GZIPInputStream(schemData);
|
||||
} else {
|
||||
return schemData;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("SchemData is wrong", e);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import kotlinx.serialization.Serializable
|
||||
import java.lang.StringBuilder
|
||||
import java.sql.Timestamp
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
|
||||
@Serializable
|
||||
data class ShortEvent(val id: Int, val name: String, val start: Long, val end: Long) {
|
||||
@@ -82,8 +83,8 @@ data class UpdateEvent(
|
||||
val maxTeamMembers: Int? = null,
|
||||
val schemType: String? = null,
|
||||
val publicSchemsOnly: Boolean? = null,
|
||||
val addReferee: Set<Int>? = null,
|
||||
val removeReferee: Set<Int>? = null,
|
||||
val addReferee: Set<String>? = null,
|
||||
val removeReferee: Set<String>? = null,
|
||||
)
|
||||
|
||||
fun Route.configureEventsRoute() {
|
||||
@@ -204,13 +205,13 @@ fun Route.configureEventsRoute() {
|
||||
|
||||
if (updateEvent.addReferee != null) {
|
||||
updateEvent.addReferee.forEach {
|
||||
Referee.add(event.eventID, it)
|
||||
Referee.add(event.eventID, SteamwarUser.get(UUID.fromString(it)).id)
|
||||
}
|
||||
}
|
||||
|
||||
if (updateEvent.removeReferee != null) {
|
||||
updateEvent.removeReferee.forEach {
|
||||
Referee.remove(event.eventID, it)
|
||||
Referee.remove(event.eventID, SteamwarUser.get(UUID.fromString(it)).id)
|
||||
}
|
||||
}
|
||||
event.update(eventName, deadline, start, end, schemType, maxTeamMembers, publicSchemsOnly)
|
||||
|
||||
@@ -108,7 +108,7 @@ fun Route.configurePage() {
|
||||
json()
|
||||
}
|
||||
defaultRequest {
|
||||
url("https://steamwar.de/devlabs/api/v1/")
|
||||
url("https://git.steamwar.de/api/v1/")
|
||||
header("Authorization", "token " + config.giteaToken)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ fun Route.configureSchematic() {
|
||||
}
|
||||
|
||||
call.response.header("Content-Disposition", "attachment; filename=\"${node.name}${data.nodeFormat.fileEnding}\"")
|
||||
call.respondBytes(data.schemData().readAllBytes(), contentType = ContentType.Application.OctetStream, status = HttpStatusCode.OK)
|
||||
call.respondBytes(data.schemData(false).readAllBytes(), contentType = ContentType.Application.OctetStream, status = HttpStatusCode.OK)
|
||||
}
|
||||
get("/info") {
|
||||
val node = call.receiveSchematic() ?: return@get
|
||||
|
||||
Reference in New Issue
Block a user