-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/repository #4
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2917a8b
Enhance `Ticket` entity: auto-generate `reporterToken` for anonymous …
simonforsberg 6afce41
Update `TicketComment` entity: add `isInternalNote` field to support …
simonforsberg 6054dfa
Add `TicketRepository` interface to support Ticket-related queries
simonforsberg db02b93
Add `TicketCommentRepository` to support TicketComment-related queries
simonforsberg ff34ab5
Add `AttachmentRepository` to support Attachment-related queries
simonforsberg cda0d9b
Add `AuditLogRepository` to support AuditLog-related queries
simonforsberg 514f2d0
Add `UserRepository` to support User-related queries
simonforsberg d4b68dd
Enhance repository interfaces: add query methods to `TicketRepository…
simonforsberg 68d048c
Enhance `Ticket` entity: add `comments` and `auditLogs` relationships…
simonforsberg f812a82
Update `Ticket` and `TicketComment` entities: refine column definitio…
simonforsberg 8b1a7a3
Simplify `UserRepository` and update `Ticket` and `TicketComment` ent…
simonforsberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/org/example/alfs/repositories/AttachmentRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package org.example.alfs.repositories; | ||
|
|
||
| import org.example.alfs.entities.Attachment; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface AttachmentRepository extends JpaRepository<Attachment, Long> { | ||
|
|
||
| // Hämta alla bilagor i ett fall | ||
| List<Attachment> findByTicketId(Long ticketId); | ||
|
|
||
| } |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/example/alfs/repositories/AuditLogRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package org.example.alfs.repositories; | ||
|
|
||
| import org.example.alfs.entities.AuditLog; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface AuditLogRepository extends JpaRepository<AuditLog, Long> { | ||
|
|
||
| // Hämta logghistoriken i ett fall, nyast först | ||
| List<AuditLog> findByTicketIdOrderByCreatedAtDesc(Long ticketId); | ||
|
|
||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/example/alfs/repositories/TicketCommentRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package org.example.alfs.repositories; | ||
|
|
||
| import org.example.alfs.entities.TicketComment; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface TicketCommentRepository extends JpaRepository<TicketComment, Long> { | ||
|
|
||
| // Ladda alla kommentarer i ett fall, äldst först | ||
| List<TicketComment> findByTicketIdOrderByCreatedAtAsc(Long ticketId); | ||
|
|
||
| // Ladda interna meddelanden för utredare/admins, äldst först | ||
| List<TicketComment> findByTicketIdAndIsInternalNoteOrderByCreatedAtAsc(Long ticketId, boolean isInternalNote); | ||
| } |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/example/alfs/repositories/TicketRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package org.example.alfs.repositories; | ||
|
|
||
| import org.example.alfs.entities.Ticket; | ||
| import org.example.alfs.enums.TicketStatus; | ||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| public interface TicketRepository extends JpaRepository<Ticket, Long> { | ||
|
|
||
| // Anonym anmälare ser sitt fall med token | ||
| Optional<Ticket> findByReporterToken(String reporterToken); | ||
|
|
||
| // Inloggad anmälare ser sitt/sina fall | ||
| List<Ticket> findByReporterId(Long reporterId); | ||
|
|
||
| // Utredare ser sina tilldelade fall | ||
| List<Ticket> findByInvestigatorId(Long investigatorId); | ||
|
|
||
| // Filtrera fall efter status | ||
| List<Ticket> findByStatus(TicketStatus status); | ||
|
|
||
| // Filtrera fall efter status och utredare | ||
| List<Ticket> findByStatusAndInvestigatorId(TicketStatus status, Long investigatorId); | ||
|
|
||
| // Hämta alla fall, paginerat | ||
| Page<Ticket> findAll(Pageable pageable); | ||
|
|
||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/example/alfs/repositories/UserRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package org.example.alfs.repositories; | ||
|
|
||
| import org.example.alfs.entities.User; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| public interface UserRepository extends JpaRepository<User, Long> { | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ithsjava25/project-backend-alfs
Length of output: 57
🏁 Script executed:
Repository: ithsjava25/project-backend-alfs
Length of output: 838
🏁 Script executed:
Repository: ithsjava25/project-backend-alfs
Length of output: 569
🏁 Script executed:
Repository: ithsjava25/project-backend-alfs
Length of output: 246
🏁 Script executed:
Repository: ithsjava25/project-backend-alfs
Length of output: 237
Add/verify DB migration for new non-null column.
The new non-null field
isInternalNoteat line 30 requires a database migration on existing environments. Currently, the repository has no migration infrastructure (no Flyway, Liquibase, or migration files detected), and no migration for this column exists. This will fail on deployment against databases with historical rows. Either establish migration infrastructure and add a migration that backfillsis_internal_notewith a default value before enforcing the non-null constraint, or adjust the column definition.🤖 Prompt for AI Agents