-
Notifications
You must be signed in to change notification settings - Fork 0
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
(POC) Rethinking type_owners table #14
Conversation
|
||
public void deleteOmniTypeById(Long id) { | ||
log.info("Delete omni type by data type [{}]", id); | ||
omniTypeRepository.deleteById(id); |
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.
pls check if it's exist or throw notFoundException
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.
done
|
||
Long id; | ||
String dataType; | ||
String meta; |
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.
what format of data we will store in metadata? I thought it will be Map<String, Object> meta
and json in db
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.
let's start with String and once we need to implement specific logic, we can change it
- integrate OmniType with Omni in TestDataStorageService - update migration - update tests - remove purgeAllData
Long id; | ||
String dataType; | ||
String meta; | ||
LocalDateTime created; | ||
LocalDateTime updated; |
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.
Long id; | |
String dataType; | |
String meta; | |
LocalDateTime created; | |
LocalDateTime updated; | |
private Long id; | |
private String dataType; | |
private String meta; | |
private LocalDateTime created; | |
private LocalDateTime updated; |
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.
done
@@ -14,14 +16,24 @@ | |||
@RequiredArgsConstructor |
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.
constructor not needed here since all methods are static
the class can be marked as @UtilityClass
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.
done
var omniType = getOmniTypeIfExists(dataType); | ||
var omni = Omni.builder() | ||
.data(data) | ||
.omniType(omniType) | ||
.archived(false) | ||
.created(LocalDateTime.now()) |
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.
a point for future improvement - created can be set automatically by Jpa audit
var omnis = omniRepository.findAllByOmniTypeAndCreatedBefore(omniType, archiveOmniDTO.getCreatedBefore()); | ||
if (!omnis.isEmpty()) { | ||
omnis.forEach(omni -> { | ||
omni.setUpdated(LocalDateTime.now()); |
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.
same - updated can be set by @ModifiedDate
and JPA audit
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.
#16 issue created
make EntityMapper annotated with UtilityClass
@@ -1,15 +1,12 @@ | |||
package com.auto1.testdatastorage.service; |
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.
there should be 2 separate service classes:
- OmniQueueItemService
- OmniTypeService
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.
ok, will do separation
separate TestDataStorageController to OmniQueueController.java and OmniTypeController.java
Create new table omni_type instead of type_owners
Add new endpoints:
-POST /queue/omni-type - Create omni type
-PUT /queue/omni-type/{id} - Update omni type
-DELETE /queue/omni-type/{id} - Delete omni type
-GET /queue/omni-types - Get all omni types
Add tests