-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/meeting protocol generation #62
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
Changes from all commits
e3727ab
9ea0a2f
7aa6f76
d25196f
6d6884a
8218620
9beeee6
8f147ea
65ef2b9
2f5aaef
7c6c689
af9a1c2
9dd20de
986b921
08b0697
3319825
747c013
ed1c530
1d93b80
b126875
2d9433b
56fede1
2033082
f650d13
97c2e8b
e74feb7
762d1ee
ca02933
b78fe1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CREATE DATABASE team4you_test; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| package backendlab.team4you.exceptions; | ||
|
|
||
| public class MeetingNotFoundException extends RuntimeException { | ||
| public MeetingNotFoundException(String message) { | ||
| super(message); | ||
| private final Long meetingId; | ||
|
|
||
| public MeetingNotFoundException(Long meetingId) { | ||
| super("Sammanträdet hittades inte."); | ||
| this.meetingId = meetingId; | ||
| } | ||
|
|
||
| public Long getMeetingId() { | ||
| return meetingId; | ||
| } | ||
|
MartinStenhagen marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package backendlab.team4you.exceptions; | ||
|
|
||
| public class ProtocolAlreadyExistsException extends RuntimeException { | ||
|
|
||
| public ProtocolAlreadyExistsException(Long meetingId) { | ||
| super("Protocol already exists for meeting. meetingId=" + meetingId); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package backendlab.team4you.exceptions; | ||
|
|
||
| public class ProtocolNotFoundException extends RuntimeException { | ||
|
|
||
| public ProtocolNotFoundException(Long protocolId) { | ||
| super("Protocol not found. protocolId=" + protocolId); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package backendlab.team4you.exceptions; | ||
|
|
||
| public class ProtocolParagraphNotFoundException extends RuntimeException { | ||
| private final Long paragraphId; | ||
|
|
||
| public ProtocolParagraphNotFoundException(Long paragraphId) { | ||
| super("Protokollparagrafen hittades inte."); | ||
| this.paragraphId = paragraphId; | ||
| } | ||
|
|
||
| public Long getParagraphId() { | ||
| return paragraphId; | ||
| } | ||
|
MartinStenhagen marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,10 +37,11 @@ public MeetingController( | |
| public String meetingsPage( | ||
| @RequestParam(required = false) Long registryId, | ||
| @RequestParam(required = false) Long selectedMeetingId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| populateMeetingsPage(model, registryId, selectedMeetingId); | ||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping | ||
|
|
@@ -69,7 +70,7 @@ public String createMeeting( | |
| notes | ||
| ); | ||
|
|
||
| model.addAttribute("successMessage", "sammanträdet skapades."); | ||
| model.addAttribute("successMessage", "Sammanträdet skapades."); | ||
| populateMeetingsPage(model, registryId, meeting.getId()); | ||
|
|
||
| } catch (InvalidMeetingStateException | MeetingNotFoundException | RegistryNotFoundException exception) { | ||
|
|
@@ -81,11 +82,7 @@ public String createMeeting( | |
| populateMeetingsPage(model, safeRegistryId, null); | ||
| } | ||
|
|
||
| if (htmx != null) { | ||
| return "fragments/admin-meetings :: content"; | ||
| } | ||
|
|
||
| return "admin/meetings"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/update") | ||
|
|
@@ -97,6 +94,7 @@ public String updateMeeting( | |
| @RequestParam(required = false) String location, | ||
| @RequestParam(required = false) String notes, | ||
| @RequestParam MeetingStatus status, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -115,7 +113,7 @@ public String updateMeeting( | |
| status | ||
| ); | ||
|
|
||
| model.addAttribute("successMessage", "sammanträdet uppdaterades."); | ||
| model.addAttribute("successMessage", "Sammanträdet uppdaterades."); | ||
| populateMeetingsPage(model, updatedMeeting.getRegistry().getId(), updatedMeeting.getId()); | ||
|
|
||
| } catch (InvalidMeetingStateException | MeetingNotFoundException | RegistryNotFoundException exception) { | ||
|
|
@@ -129,12 +127,13 @@ public String updateMeeting( | |
| populateMeetingsPage(model, registryId, registryId == null ? null : meetingId); | ||
| } | ||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/delete") | ||
| public String deleteMeeting( | ||
| @PathVariable Long meetingId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -143,15 +142,15 @@ public String deleteMeeting( | |
|
|
||
| meetingService.deleteMeeting(meetingId); | ||
|
|
||
| model.addAttribute("successMessage", "sammanträdet togs bort."); | ||
| model.addAttribute("successMessage", "Sammanträdet togs bort."); | ||
| populateMeetingsPage(model, registryId, null); | ||
|
|
||
| } catch (Exception exception) { | ||
| model.addAttribute("errorMessage", exception.getMessage()); | ||
| populateMeetingsPage(model, null, null); | ||
| } | ||
|
Comment on lines
+148
to
+151
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Catch‑all Catching Prefer catching the concrete domain exceptions the service is documented to throw (e.g. 🤖 Prompt for AI Agents |
||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @GetMapping("/{meetingId}") | ||
|
|
@@ -167,7 +166,7 @@ public String showMeeting( | |
| return "fragments/admin-meetings :: content"; | ||
| } | ||
|
|
||
| return "admin/meetings"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/agenda-items") | ||
|
|
@@ -192,17 +191,14 @@ public String addAgendaItem( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| if (htmx != null) { | ||
| return "fragments/admin-meetings :: content"; | ||
| } | ||
|
|
||
| return "admin/meetings"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/agenda-items/{agendaItemId}/move-up") | ||
| public String moveAgendaItemUp( | ||
| @PathVariable Long meetingId, | ||
| @PathVariable Long agendaItemId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -218,13 +214,14 @@ public String moveAgendaItemUp( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/agenda-items/{agendaItemId}/move-down") | ||
| public String moveAgendaItemDown( | ||
| @PathVariable Long meetingId, | ||
| @PathVariable Long agendaItemId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -240,7 +237,7 @@ public String moveAgendaItemDown( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @DeleteMapping("/{meetingId}/agenda-items/{agendaItemId}") | ||
|
|
@@ -265,18 +262,15 @@ public String removeAgendaItem( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| if (htmx != null) { | ||
| return "fragments/admin-meetings :: content"; | ||
| } | ||
|
|
||
| return "admin/meetings"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/agenda-items/{agendaItemId}/documents") | ||
| public String addAgendaDocument( | ||
| @PathVariable Long meetingId, | ||
| @PathVariable Long agendaItemId, | ||
| @RequestParam Long caseFileId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -292,14 +286,15 @@ public String addAgendaDocument( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| @PostMapping("/{meetingId}/agenda-items/{agendaItemId}/documents/{documentId}/remove") | ||
| public String removeAgendaDocument( | ||
| @PathVariable Long meetingId, | ||
| @PathVariable Long agendaItemId, | ||
| @PathVariable Long documentId, | ||
| @RequestHeader(value = "HX-Request", required = false) String htmx, | ||
| Model model | ||
| ) { | ||
| try { | ||
|
|
@@ -315,7 +310,7 @@ public String removeAgendaDocument( | |
| populateMeetingsPageAfterMeetingAction(model, null, null); | ||
| } | ||
|
|
||
| return "fragments/admin-meetings :: content"; | ||
| return meetingsView(htmx); | ||
| } | ||
|
|
||
| private void populateMeetingsPageAfterMeetingAction(Model model, Long registryId, Long meetingId) { | ||
|
|
@@ -371,4 +366,13 @@ private void populateMeetingsPage(Model model, Long registryId, Long selectedMee | |
| model.addAttribute("documentsByAgendaItemId", documentsByAgendaItemId); | ||
| model.addAttribute("availableFilesByAgendaItemId", availableFilesByAgendaItemId); | ||
| } | ||
|
|
||
| private String meetingsView(String htmx) { | ||
| if (htmx != null) { | ||
| return "fragments/admin-meetings :: content"; | ||
| } | ||
|
|
||
| return "admin/meetings"; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
|
|
||
| import backendlab.team4you.registry.Registry; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
|
|
||
| import java.util.List; | ||
|
|
||
|
|
@@ -10,4 +11,17 @@ public interface MeetingRepository extends JpaRepository<Meeting, Long> { | |
| List<Meeting> findByRegistryOrderByStartsAtAsc(Registry registry); | ||
| List<Meeting> findByRegistryOrderByStartsAtDesc(Registry registry); | ||
| List<Meeting> findAllByOrderByStartsAtDesc(); | ||
|
Comment on lines
+11
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
rg -nP --type=java -C2 '\bfindByRegistryOrderByStartsAtAsc\s*\('
rg -nP --type=java -C2 '\bfindByRegistryOrderByStartsAtDesc\s*\('
rg -nP --type=java -C2 '\bfindAllByOrderByStartsAtDesc\s*\('Repository: ithsjava25/project-backend-team4you Length of output: 2768 Remove the unused The method at line 11 has no callers in the codebase. Only 🤖 Prompt for AI Agents |
||
|
|
||
| @Query(""" | ||
| select m | ||
| from Meeting m | ||
| where m.status = backendlab.team4you.meeting.MeetingStatus.COMPLETED | ||
| and not exists ( | ||
| select p.id | ||
| from Protocol p | ||
| where p.meeting = m | ||
| ) | ||
| order by m.startsAt desc | ||
| """) | ||
| List<Meeting> findCompletedMeetingsWithoutProtocol(); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.