Added input, hardware fields to data

This commit is contained in:
2026-08-09 17:25:18 +02:00
parent 8f4c6cc630
commit 60b1a69bc6
10 changed files with 184 additions and 36 deletions
@@ -65,6 +65,8 @@ class Entry(id: EntityID<Uuid>) : Entity<Uuid>(id) {
var warmups by Entries.warmups
var measurements by Entries.measurements
var unit by Entries.unit
var input by Entries.input
var hardware by Entries.hardware
var project by Project referencedOn Entries.projectId
var label by Label referencedOn Entries.labelId
@@ -47,4 +47,6 @@ object Entries : UuidTable() {
val warmups = list<Float>("warmups")
val measurements = list<Float>("measurements")
val unit = enumeration<TimeUnit>("unit")
val input = varchar("input", 255).default("")
val hardware = varchar("hardware", 255).default("")
}
@@ -56,7 +56,7 @@ object ProjectHandler {
private fun Project.toResponse(user: User) = ProjectResponse(
id.value, name, NamedID(owner.username, owner.id.value), isPublic, isEditableBy(user),
labels.orderBy(Labels.label to SortOrder.ASC).map { LabelResponse(it.id.value, it.label, it.color) },
entries.orderBy(Entries.timestamp to SortOrder.ASC).map { EntryResponse(it.id.value, it.label.id.value, it.timestamp, it.warmups, it.measurements, it.unit) })
entries.orderBy(Entries.timestamp to SortOrder.ASC).map { EntryResponse(it.id.value, it.label.id.value, it.timestamp, it.warmups, it.measurements, it.unit, it.input, it.hardware) })
fun home(user: User, req: EmptyRequest) = transaction {
val own = user.projects.orderBy(Projects.name to SortOrder.ASC).map {
@@ -188,9 +188,11 @@ object ProjectHandler {
timestamp = req.timestamp
warmups = req.warmups
unit = req.unit
input = req.input
hardware = req.hardware
}
val response = EntryResponse(entry.id.value, entry.label.id.value, entry.timestamp, entry.warmups, entry.measurements, entry.unit)
val response = EntryResponse(entry.id.value, entry.label.id.value, entry.timestamp, entry.warmups, entry.measurements, entry.unit, entry.input, entry.hardware)
ServerScope.launch {
Buses.projectBus(proj.id.value).sendAll(ProjectEvent.NewEntry(response))
}