Skip to content

Commit cd6c54c

Browse files
refactor(storage): name ticket repository fragments by purpose CU-86agmkyyu
1 parent 7f1c252 commit cd6c54c

16 files changed

Lines changed: 43 additions & 42 deletions

‎docs/reference/architecture/data-mongo-sync/ticket-repository/ticket-repository.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ The module is implemented in `openframe-data-mongo-sync` and is enabled only whe
88

99
| Component | Responsibility |
1010
| --- | --- |
11-
| `CustomTicketRepository` | Defines the ticket query, pagination, reporting, transition, synchronization, and activity-stamping contract. |
12-
| `CustomTicketRepositoryImpl` | Implements the contract with Spring Data MongoDB queries, aggregations, targeted updates, tenant criteria, and cursor handling. |
11+
| `TicketRepositoryOperations` | Defines the ticket query, pagination, reporting, transition, synchronization, and activity-stamping contract. |
12+
| `TicketRepositoryOperationsImpl` | Implements the contract with Spring Data MongoDB queries, aggregations, targeted updates, tenant criteria, and cursor handling. |
1313
| `TicketAggregateSpec` | Describes the ticket aggregate for event publication and connects ticket changes to projections. |
1414
| `TimeEntryTicketView` | Stores the ticket fields reconciled by the time-entry projection. |
1515

1616
Source files:
1717

18-
- [`CustomTicketRepository.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepository.java)
19-
- [`CustomTicketRepositoryImpl.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepositoryImpl.java)
18+
- [`TicketRepositoryOperations.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketRepositoryOperations.java)
19+
- [`TicketRepositoryOperationsImpl.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketRepositoryOperationsImpl.java)
2020
- [`TicketAggregateSpec.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/publishing/TicketAggregateSpec.java)
2121
- [`TimeEntryTicketView.java`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/publishing/TimeEntryTicketView.java)
2222

@@ -26,8 +26,8 @@ The repository separates read composition, persistence operations, and publicati
2626

2727
```mermaid
2828
flowchart LR
29-
Caller["Ticket Service or API Caller"] --> Contract["Custom Ticket Repository"]
30-
Contract --> Impl["Custom Ticket Repository Implementation"]
29+
Caller["Ticket Service or API Caller"] --> Contract["Ticket Repository Operations"]
30+
Contract --> Impl["Ticket Repository Operations Implementation"]
3131
Impl --> TenantSupport["Tenant-Aware Repository Support"]
3232
TenantSupport --> Mongo["Tenant-Aware Mongo Template"]
3333
Mongo --> Tickets[("Ticket Documents")]
@@ -41,7 +41,7 @@ flowchart LR
4141

4242
## Runtime Conditions and Tenant Isolation
4343

44-
`CustomTicketRepositoryImpl` extends `TenantAwareRepositorySupport`, so tenant criteria are applied through the shared repository infrastructure for tenant-bound operations. The implementation is conditionally registered only when tenant isolation is enabled. This prevents the custom repository from being active in an application configuration that has not opted into the tenant-aware data path.
44+
`TicketRepositoryOperationsImpl` extends `TenantAwareRepositorySupport`, so tenant criteria are applied through the shared repository infrastructure for tenant-bound operations. The implementation is conditionally registered only when tenant isolation is enabled. This prevents the repository fragment from being active in an application configuration that has not opted into the tenant-aware data path.
4545

4646
Owner-scoped reads add a second layer of visibility control for agent principals:
4747

@@ -174,7 +174,7 @@ The activity methods return the newly written ticket when available. Their versi
174174

175175
`TicketAggregateSpec` identifies the aggregate type as `tickets`. It converts a `Ticket` into a compact `TicketEvent` containing the ticket ID and title, then exposes the `TicketOnTimeEntriesProjection` as its projection.
176176

177-
This means a ticket change can update the ticket-related fields used by time-entry processing without requiring the projection to consume the entire ticket document. `CustomTicketRepositoryImpl.updateTitle` explicitly uses the same specification for title writes that occur outside the normal repository save path, preserving publication behavior for that special mutation.
177+
This means a ticket change can update the ticket-related fields used by time-entry processing without requiring the projection to consume the entire ticket document. `TicketRepositoryOperationsImpl.updateTitle` explicitly uses the same specification for title writes that occur outside the normal repository save path, preserving publication behavior for that special mutation.
178178

179179
`TimeEntryTicketView` is the projection's persisted read model. It contains:
180180

‎openframe-api-lib/src/test/java/com/openframe/api/service/TicketQueryServiceTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import com.openframe.data.document.ticket.filter.TicketQueryFilter;
66
import com.openframe.data.mongo.TenantAwareMongoTemplate;
77
import com.openframe.data.repository.cursor.CursorPosition;
8-
import com.openframe.data.repository.ticket.CustomTicketRepository;
9-
import com.openframe.data.repository.ticket.CustomTicketRepositoryImpl;
8+
import com.openframe.data.repository.ticket.TicketRepositoryOperations;
9+
import com.openframe.data.repository.ticket.TicketRepositoryOperationsImpl;
1010
import com.openframe.data.repository.ticket.TicketRepository;
1111
import com.openframe.data.repository.ticket.publishing.TicketAggregateSpec;
1212
import com.openframe.publishing.api.OutboxPublisher;
@@ -113,7 +113,7 @@ void searchTickets_afterARawTicketId_newestFirstPastThatRow() {
113113
@Test
114114
void searchTickets_afterATicketThatWasRemoved_newestFirstPastThatId() {
115115
// setup
116-
CustomTicketRepository storedTickets = new CustomTicketRepositoryImpl(mongoTemplate, outboxPublisher, ticketSpec);
116+
TicketRepositoryOperations storedTickets = new TicketRepositoryOperationsImpl(mongoTemplate, outboxPublisher, ticketSpec);
117117
CursorPosition afterRow = new CursorPosition.RowId(AFTER_TICKET_ID);
118118
Document pastTheRemovedTicket = new Document("_id", new Document("$lt", new ObjectId(AFTER_TICKET_ID)));
119119
Document newestFirst = new Document(CREATED_AT, -1).append("_id", -1);

‎openframe-api-lib/src/test/java/com/openframe/api/service/ticket/TicketServicePaginationTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import com.openframe.data.repository.cursor.KeysetCursor;
1818
import com.openframe.data.repository.device.MachineRepository;
1919
import com.openframe.data.repository.organization.OrganizationRepository;
20-
import com.openframe.data.repository.ticket.CustomTicketRepository;
21-
import com.openframe.data.repository.ticket.CustomTicketRepositoryImpl;
20+
import com.openframe.data.repository.ticket.TicketRepositoryOperations;
21+
import com.openframe.data.repository.ticket.TicketRepositoryOperationsImpl;
2222
import com.openframe.data.repository.ticket.TicketRepository;
2323
import com.openframe.data.repository.user.UserRepository;
2424
import com.openframe.security.authentication.ActorType;
@@ -107,7 +107,7 @@ class TicketServicePaginationTest {
107107
.build();
108108

109109
@SuppressWarnings("unchecked")
110-
private final CustomTicketRepository cursorIssuer = new CustomTicketRepositoryImpl(
110+
private final TicketRepositoryOperations cursorIssuer = new TicketRepositoryOperationsImpl(
111111
mock(TenantAwareMongoTemplate.class), mock(ObjectProvider.class), mock(ObjectProvider.class));
112112

113113
@Test

‎openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketAttachmentRepository.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/** Reads and writes metadata for files linked to tickets. */
1313
@Repository
1414
public interface TicketAttachmentRepository extends MongoRepository<TicketAttachment, String>,
15-
CustomTicketAttachmentRepository {
15+
TicketAttachmentUpsertOperations {
1616

1717
List<TicketAttachment> findByTicketId(String ticketId);
1818

openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketAttachmentRepository.java renamed to openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketAttachmentUpsertOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.openframe.data.document.ticket.TicketAttachment;
44

55
/** Stores each ticket attachment once using a storage path owned by that ticket and unique within its tenant. */
6-
public interface CustomTicketAttachmentRepository {
6+
public interface TicketAttachmentUpsertOperations {
77

88
TicketAttachment insertIfAbsent(TicketAttachment attachment);
99

openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketAttachmentRepositoryImpl.java renamed to openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketAttachmentUpsertOperationsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/** Atomically inserts ticket attachment metadata while preserving an existing copy on retry. */
2323
@RequiredArgsConstructor
24-
public class CustomTicketAttachmentRepositoryImpl implements CustomTicketAttachmentRepository {
24+
public class TicketAttachmentUpsertOperationsImpl implements TicketAttachmentUpsertOperations {
2525
private static final String DOCUMENT_ID = "_id";
2626

2727
private final MongoTemplate mongoTemplate;

‎openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketRepository.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@Repository
1515
@TenantAwareRepository
16-
public interface TicketRepository extends MongoRepository<Ticket, String>, CustomTicketRepository {
16+
public interface TicketRepository extends MongoRepository<Ticket, String>, TicketRepositoryOperations {
1717

1818
Optional<Ticket> findByTicketNumber(Integer ticketNumber);
1919

openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepository.java renamed to openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketRepositoryOperations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java.util.Map;
1414
import java.util.Optional;
1515

16-
public interface CustomTicketRepository {
16+
public interface TicketRepositoryOperations {
1717

1818
default Query buildTicketQuery(TicketQueryFilter filter) {
1919
return buildTicketQuery(filter, null, null, null);

openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/CustomTicketRepositoryImpl.java renamed to openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/TicketRepositoryOperationsImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
@Slf4j
4949
@ConditionalOnProperty(name = "openframe.tenant-isolation.enabled", havingValue = "true")
50-
public class CustomTicketRepositoryImpl extends TenantAwareRepositorySupport implements CustomTicketRepository {
50+
public class TicketRepositoryOperationsImpl extends TenantAwareRepositorySupport implements TicketRepositoryOperations {
5151

5252
private static final String SORT_DESC = "DESC";
5353
private static final String ID_FIELD = "_id";
@@ -104,8 +104,9 @@ public class CustomTicketRepositoryImpl extends TenantAwareRepositorySupport imp
104104
private final ObjectProvider<OutboxPublisher> outboxPublisher;
105105
private final ObjectProvider<TicketAggregateSpec> ticketSpec;
106106

107-
public CustomTicketRepositoryImpl(TenantAwareMongoTemplate mongoTemplate, ObjectProvider<OutboxPublisher> outboxPublisher,
108-
ObjectProvider<TicketAggregateSpec> ticketSpec) {
107+
public TicketRepositoryOperationsImpl(TenantAwareMongoTemplate mongoTemplate,
108+
ObjectProvider<OutboxPublisher> outboxPublisher,
109+
ObjectProvider<TicketAggregateSpec> ticketSpec) {
109110
super(mongoTemplate);
110111
this.outboxPublisher = outboxPublisher;
111112
this.ticketSpec = ticketSpec;

‎openframe-data-mongo-sync/src/main/java/com/openframe/data/repository/ticket/publishing/TicketAggregateSpec.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import java.util.List;
1010

11-
// TicketRepository publishes with this spec, and so does CustomTicketRepositoryImpl.updateTitle, which writes outside it.
11+
// TicketRepository publishes with this spec, and so does TicketRepositoryOperationsImpl.updateTitle, which writes outside it.
1212
@Component
1313
@RequiredArgsConstructor
1414
public class TicketAggregateSpec implements AggregateSpec<Ticket, TicketEvent> {

0 commit comments

Comments
 (0)