Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program #6

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e03d274
Create, edit and export empty program
claire-lucas Jun 4, 2024
973560e
Manual session
claire-lucas Jun 6, 2024
d03b3f1
Manual Session CRUD
claire-lucas Jun 6, 2024
9f0cb6d
Update track order
claire-lucas Jun 6, 2024
2a0ea13
Hall List in CRUD service
claire-lucas Jun 6, 2024
04dc9c3
Init tests
claire-lucas Jun 7, 2024
70533e6
Set SlotDB in its own repo
claire-lucas Jun 7, 2024
d20f640
Merge branch 'program' into test
claire-lucas Jun 7, 2024
4ec609c
Update SlotAdapterTest to reflect changes in SlotAdapter
claire-lucas Jun 7, 2024
3d9a13f
Ignore PDF generation tests
claire-lucas Jun 7, 2024
cfb7036
Change HallPatchReq to reflect usage
claire-lucas Jun 7, 2024
a82c4aa
Modify log to fit standard way
claire-lucas Jun 7, 2024
e1b2aa2
Create empty SessionPatchReq more easily
claire-lucas Jun 7, 2024
44d5fe2
Fix SessionImport to use id instead of year
claire-lucas Jun 7, 2024
e4d7b35
Remove unused EventCreationReq
claire-lucas Jun 7, 2024
b60b32b
Merge branch 'program' into test
claire-lucas Jun 7, 2024
fd14e6e
Reorganize HallController to have all list requests in the same place
claire-lucas Jun 10, 2024
ec9ac7c
Updating the order of a hall returns the hall as a DTO
claire-lucas Jun 10, 2024
6b2475c
fix receiver type mismatch
claire-lucas Jun 10, 2024
0514035
Entity generating methods for tests
claire-lucas Jun 10, 2024
a49fd47
HallController tested
claire-lucas Jun 10, 2024
e95fe2a
Change setSession to setSlot to reflect function behaviour
claire-lucas Jun 10, 2024
bcc2c38
fix log to reflect other usages
claire-lucas Jun 10, 2024
28ce7f7
SessionController tested
claire-lucas Jun 10, 2024
afd006f
Simplify deleteSlot
claire-lucas Jun 10, 2024
89eab14
SlotController tested
claire-lucas Jun 10, 2024
2150742
SpeakerController tested
claire-lucas Jun 10, 2024
08c596a
EventGet tested
claire-lucas Jun 10, 2024
51b7de0
HallAssociateEvent tested
claire-lucas Jun 10, 2024
0e64d26
Replace all !! assertions with requireNotNull calls
claire-lucas Jun 10, 2024
02fa263
HallCRUD tested
claire-lucas Jun 10, 2024
8897535
HallSetOrder tested
claire-lucas Jun 10, 2024
35d5076
ManualSessionCRUD tested
claire-lucas Jun 10, 2024
5f5e8ac
Add TODO to Import tests
claire-lucas Jun 10, 2024
ad8bdfc
SessionList tested
claire-lucas Jun 10, 2024
d5150b8
SlotSetSession tested
claire-lucas Jun 10, 2024
909806b
SlotCRUD tested
claire-lucas Jun 10, 2024
65e9a67
SlotAssociateHall tested
claire-lucas Jun 10, 2024
fb43c5a
mappers tested
claire-lucas Jun 10, 2024
cdcf5ca
KalonAdapter tested
claire-lucas Jun 11, 2024
5924300
Add Throws decorator to EventAdapter.getById, as the Optional.get can…
claire-lucas Jun 11, 2024
e663870
EventAdapter tested
claire-lucas Jun 11, 2024
0073ad1
Remove unused filter method
claire-lucas Jun 11, 2024
116e7bb
Add Throws decorator to SpeakerAdapter.getById, as the Optional.get c…
claire-lucas Jun 11, 2024
570690e
SpeakerAdapter tested
claire-lucas Jun 11, 2024
5f97be8
change barcode building method
claire-lucas Jun 11, 2024
33f2cc2
Make SlotAdapter more readable
claire-lucas Jun 12, 2024
c4eaf9e
SlotAdapter tested
claire-lucas Jun 12, 2024
7a7c8e2
ManualSessionAdapter tested
claire-lucas Jun 13, 2024
8684280
HallAdapter tested
claire-lucas Jun 13, 2024
df290fb
SpeakerImport tested
claire-lucas Jun 13, 2024
86c9af4
Modify SlotCreationReq to adapt to multi-hall
claire-lucas Jun 13, 2024
8483e90
konter tested (except PDF generation)
claire-lucas Jun 17, 2024
9571751
Export talks.json, halls are always ordered and PDF generation does d…
claire-lucas Jun 24, 2024
6fe52f0
Replace coEvery by every
claire-lucas Jun 24, 2024
118bb01
Nest event.begin null check to avoid double check
claire-lucas Jun 24, 2024
a81858f
Remove SpeakerFilter
claire-lucas Jun 24, 2024
3f6f484
Update Tests
claire-lucas Jun 24, 2024
5461977
Make SlotDB extension functions non private and add message to requir…
claire-lucas Jun 25, 2024
2c7303a
Fix hashcode computation
claire-lucas Jun 25, 2024
5fb1ce0
Tests (except PDF generation)
claire-lucas Jun 25, 2024
07e177b
Remove PDF generation tests
claire-lucas Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@
<artifactId>kotlin-logging-jvm</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.8</version>
</dependency>
<dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-core</artifactId>
<version>8.0.4</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<version>6.0.7</version>
Expand All @@ -88,7 +89,19 @@
<classifier>jakarta</classifier>
<version>${querydsl.version}</version>
</dependency>
</dependencies>
<dependency>
<groupId>com.ninja-squad</groupId>
<artifactId>springmockk</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-maven-plugin</artifactId>
<version>5.15.0</version>
</dependency>

</dependencies>

<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
Expand All @@ -98,6 +111,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-maven-plugin</artifactId>
<version>5.15.0</version>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package org.breizhcamp.konter.application.dto
data class HallDTO(
val id: Int,
val name: String?,
val trackId: Int?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.breizhcamp.konter.application.dto

import org.breizhcamp.konter.domain.entities.enums.SessionFormatEnum
import org.breizhcamp.konter.domain.entities.enums.SessionThemeEnum

data class ManualSessionDTO(
val id: Int,
val title: String,
val description: String,
val format: SessionFormatEnum,
val theme: SessionThemeEnum
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ data class SessionDTO(
val status: SessionStatusEnum,
val submitted: LocalDateTime,
val ownerNotes: String,
val hall: HallDTO?,
val beginning: LocalDateTime?,
val end: LocalDateTime?,
val videoURL: String?,
val rating: BigDecimal?,
val slot: SlotDTO?,
)
18 changes: 18 additions & 0 deletions src/main/kotlin/org/breizhcamp/konter/application/dto/SlotDTO.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.breizhcamp.konter.application.dto

import java.time.Duration
import java.time.LocalTime
import java.util.*

data class SlotDTO(
val id: UUID,
val day: Int,
val session: SessionDTO?,
val halls: List<HallDTO>,
val start: LocalTime,
val duration: Duration,
val barcode: String?,
val span: Int,
val title: String?,
val assignable: Boolean
)
25 changes: 25 additions & 0 deletions src/main/kotlin/org/breizhcamp/konter/application/dto/TalkDTO.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.breizhcamp.konter.application.dto

import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import java.time.LocalDateTime

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class TalkDTO(
@JsonFormat(shape = JsonFormat.Shape.STRING)
val id: Int,
val name: String,
val eventStart: LocalDateTime,
val eventEnd: LocalDateTime,
val eventType: String,
val format: String,
val venue: String,
@JsonFormat(shape = JsonFormat.Shape.STRING)
val venueId: Int,
val speakers: String,
val videoUrl: String?,
val filesUrl: String?,
val slidesUrl: String?,
val description: String?
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.breizhcamp.konter.application.requests

data class HallCreationReq(
val name: String
val name: String,
val trackId: Int?,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.breizhcamp.konter.application.requests

data class HallPatchReq(
val name: String,
val trackId: Int?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.breizhcamp.konter.application.requests

import org.breizhcamp.konter.domain.entities.enums.SessionFormatEnum
import org.breizhcamp.konter.domain.entities.enums.SessionThemeEnum

data class SessionCreationReq(
val title: String,
val description: String,
val format: SessionFormatEnum,
val theme: SessionThemeEnum,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.breizhcamp.konter.application.requests

import org.breizhcamp.konter.domain.entities.enums.SessionFormatEnum
import org.breizhcamp.konter.domain.entities.enums.SessionThemeEnum

data class SessionPatchReq(
val title: String?,
val description: String?,
val format: SessionFormatEnum?,
val theme: SessionThemeEnum?,
) {
companion object {
fun empty(): SessionPatchReq = SessionPatchReq(
title = null,
description = null,
format = null,
theme = null
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.breizhcamp.konter.application.requests

import org.hibernate.annotations.JdbcTypeCode
import org.hibernate.type.SqlTypes
import java.time.Duration
import java.time.LocalTime

data class SlotCreationReq(
val start: LocalTime,
val day: Int,
@JdbcTypeCode(SqlTypes.INTERVAL_SECOND)
val duration: Duration,
val title: String?,
val hallIds: List<Int>,
val assignable: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.breizhcamp.konter.application.requests

data class SlotPatchReq(
val title: String?,
val assignable: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,92 @@ package org.breizhcamp.konter.application.rest
import mu.KotlinLogging
import org.breizhcamp.konter.application.dto.HallDTO
import org.breizhcamp.konter.application.requests.HallCreationReq
import org.breizhcamp.konter.application.requests.HallPatchReq
import org.breizhcamp.konter.domain.entities.Hall
import org.breizhcamp.konter.domain.use_cases.HallCreate
import org.breizhcamp.konter.domain.use_cases.HallList
import org.breizhcamp.konter.domain.entities.exceptions.EventNotFoundException
import org.breizhcamp.konter.domain.use_cases.HallAssociateEvent
import org.breizhcamp.konter.domain.use_cases.HallCRUD
import org.breizhcamp.konter.domain.use_cases.HallSetOrder
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*

private val logger = KotlinLogging.logger { }

@RestController
@RequestMapping("/api/halls")
class HallController (
private val hallCreate: HallCreate,
private val hallList: HallList,
private val hallCRUD: HallCRUD,
private val hallAssociateEvent: HallAssociateEvent,
private val hallSetOrder: HallSetOrder
) {

@GetMapping
fun listAll(): List<HallDTO> {
logger.info { "Listing all Halls" }

return hallList.listAll().map { it.toDto() }
return hallCRUD.listAll().map { it.toDto() }
}

@GetMapping("/{eventId}")
fun listByEvent(@PathVariable eventId: Int): List<HallDTO> {
logger.info { "Listing Halls available for Event:$eventId" }

return hallCRUD.listByEvent(eventId).map { it.toDto() }
}

@PostMapping
fun createHall(@RequestBody req: HallCreationReq): HallDTO {
logger.info { "Creating a Hall with name ${req.name}" }
logger.info { "Creating a Hall with name ${req.name} and trackId ${req.trackId}" }

return hallCreate.createHall(req).toDto()
return hallCRUD.create(req).toDto()
}

@GetMapping("/{eventId}")
fun listByEvent(@PathVariable eventId: Int): List<HallDTO> {
logger.info { "Listing Halls available for Event<$eventId>" }
@PatchMapping("/{id}")
fun patchHall(@PathVariable id: Int, @RequestBody req: HallPatchReq): HallDTO {
logger.info { "Updating Hall:$id" }

return hallList.listByEvent(eventId).map { it.toDto() }
return hallCRUD.update(id, req).toDto()
}

@DeleteMapping("/{id}")
fun deleteHall(@PathVariable id: Int) {
logger.info { "Deleting Hall:$id" }

return hallCRUD.delete(id)
}

@PostMapping("/{id}/event/{eventId}/{order}")
fun associateToEvent(@PathVariable id: Int, @PathVariable eventId: Int, @PathVariable order: Int): ResponseEntity<*> {
logger.info { "Associating Hall:$id to Event:$eventId" }

return try {
ResponseEntity.ok(hallAssociateEvent.associate(id, eventId, order).toDto())
} catch (e: EventNotFoundException) {
logger.error { e }

ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.message)
}
}

@DeleteMapping("/{id}/event/{eventId}")
fun dissociateFromEvent(@PathVariable id: Int, @PathVariable eventId: Int): HallDTO {
logger.info { "Dissociating Hall:$id from Event:$eventId" }

return hallAssociateEvent.dissociate(id, eventId).toDto()
}

@PatchMapping("/{id}/event/{eventId}/{order}")
fun updateOrderForEvent(@PathVariable id: Int, @PathVariable eventId: Int, @PathVariable order: Int): HallDTO {
logger.info { "Updating order of Hall:$id for Event:$eventId to $order" }

return hallSetOrder.setOrder(id, eventId, order).toDto()
}

}

fun Hall.toDto() = HallDTO(
id = id,
name = name,
trackId = trackId
)
Loading