Skip to content

Commit

Permalink
BRANCH-92 FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
OSousa117 committed Oct 17, 2023
1 parent 0a762a8 commit 89344c3
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import io.micrometer.core.lang.Nullable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.*;

import java.sql.Timestamp;
import java.util.UUID;
import lombok.AllArgsConstructor;
Expand All @@ -44,9 +42,9 @@
public class ArchivedLogEntity {

@Id
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "uuid", updatable = false, name = "id")
private UUID id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;

@Column(name = "USER_ACCOUNT")
private String userAccount;
Expand Down Expand Up @@ -75,7 +73,7 @@ public class ArchivedLogEntity {
private Boolean isFavorited;

public ArchivedLogEntity(
UUID id,
int id,
String userAccount,
Timestamp time_created,
EventType eventType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@

package org.eclipse.tractusx.demandcapacitymgmt.demandcapacitymgmtbackend.entities;

import io.micrometer.core.lang.Nullable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.annotation.Nullable;
import jakarta.persistence.*;

import java.sql.Timestamp;
import java.util.UUID;
import lombok.AllArgsConstructor;
Expand All @@ -46,9 +44,9 @@
public class LoggingHistoryEntity {

@Id
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "uuid", updatable = false, name = "id")
private UUID id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;

@Column(name = "USER_ACCOUNT")
@Nullable
Expand Down Expand Up @@ -83,7 +81,7 @@ public class LoggingHistoryEntity {
private Boolean isFavorited;

public LoggingHistoryEntity(
UUID id,
int id,
String userAccount,
Timestamp time_created,
EventType eventType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public void deleteArchivedLogById(String logId) {

private LoggingHistoryEntity convertDtoToEntity(LoggingHistoryRequest loggingHistoryRequest) {
LoggingHistoryEntity loggingHistoryEntity = new LoggingHistoryEntity();
loggingHistoryEntity.setId(UUID.randomUUID());
loggingHistoryEntity.setEventType(EventType.valueOf(loggingHistoryRequest.getEventType()));
loggingHistoryEntity.setObjectType(EventObjectType.valueOf(loggingHistoryRequest.getObjectType()));

Expand All @@ -132,7 +131,6 @@ private LoggingHistoryEntity convertDtoToEntity(LoggingHistoryRequest loggingHis

private ArchivedLogEntity convertDtoToArchivedEntity(LoggingHistoryRequest loggingHistoryRequest) {
ArchivedLogEntity loggingHistoryEntity = new ArchivedLogEntity();
loggingHistoryEntity.setId(UUID.randomUUID());
loggingHistoryEntity.setEventType(EventType.valueOf(loggingHistoryRequest.getEventType()));
loggingHistoryEntity.setObjectType(EventObjectType.valueOf(loggingHistoryRequest.getObjectType()));

Expand Down Expand Up @@ -267,7 +265,7 @@ public List<LoggingHistoryResponse> filterByFavoriteCapacityGroup() {
private LoggingHistoryResponse convertLoggingHistoryResponseDto(LoggingHistoryEntity loggingHistoryEntity) {
LoggingHistoryResponse responseDto = new LoggingHistoryResponse();

responseDto.setId(loggingHistoryEntity.getId().toString());
responseDto.setId(loggingHistoryEntity.getId());
responseDto.setEventDescription(loggingHistoryEntity.getDescription());
responseDto.setUserAccount(loggingHistoryEntity.getUserAccount());
responseDto.setIsFavorited(loggingHistoryEntity.getIsFavorited());
Expand All @@ -285,7 +283,7 @@ private ArchivedLoggingHistoryResponse convertArchivedLoggingHistoryResponseDto(
) {
ArchivedLoggingHistoryResponse responseDto = new ArchivedLoggingHistoryResponse();

responseDto.setId(archivedLogEntity.getId().toString());
responseDto.setId(archivedLogEntity.getId());
responseDto.setEventDescription(archivedLogEntity.getDescription());
responseDto.setUserAccount(archivedLogEntity.getUserAccount());
responseDto.setIsFavorited(archivedLogEntity.getIsFavorited());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const EventsTable: React.FC<EventsTableProps> = ({ events, isArchive }) => {
variant="outline-info"
onClick={() => {
// Function to copy the internalId to the clipboard
navigator.clipboard.writeText(event.id);
navigator.clipboard.writeText(event.id.toString());
}}
><FaCopy />
</Button></OverlayTrigger></td>
Expand All @@ -208,7 +208,7 @@ const EventsTable: React.FC<EventsTableProps> = ({ events, isArchive }) => {
// Function to copy the appropriate ID to the clipboard
const idToCopy = event.capacityGroupId !== "null" ? event.capacityGroupId : event.materialDemandId;
if (idToCopy !== "null") {
navigator.clipboard.writeText(idToCopy);
navigator.clipboard.writeText(idToCopy.toString());
}
}}
>
Expand All @@ -228,8 +228,8 @@ const EventsTable: React.FC<EventsTableProps> = ({ events, isArchive }) => {
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item onClick={() => handleArchiveClick(event)}><FaArchive className='text-muted' /> Archive</Dropdown.Item>
<Dropdown.Item onClick={() => { navigator.clipboard.writeText(event.id) }}><FaCopy /> Copy ID</Dropdown.Item>
<Dropdown.Item className="red-delete-item" onClick={() => handleDeleteButtonClick(event.id)}><FaTrashAlt /> Delete</Dropdown.Item>
<Dropdown.Item onClick={() => { navigator.clipboard.writeText(event.id.toString()) }}><FaCopy /> Copy ID</Dropdown.Item>
<Dropdown.Item className="red-delete-item" onClick={() => handleDeleteButtonClick(event.id.toString())}><FaTrashAlt /> Delete</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


export interface EventProp {
id: string
id: number
userAccount: string
timeCreated: string
objectType: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ components:
type: object
properties:
id:
type: string
type: integer
userAccount:
type: string
timeCreated:
Expand All @@ -1111,7 +1111,7 @@ components:
type: object
properties:
id:
type: string
type: integer
userAccount:
type: string
timeCreated:
Expand All @@ -1133,7 +1133,7 @@ components:
type: object
properties:
id:
type: string
type: integer
userAccount:
type: string
timeCreated:
Expand All @@ -1155,7 +1155,7 @@ components:
type: object
properties:
id:
type: string
type: integer
userAccount:
type: string
timeCreated:
Expand Down

0 comments on commit 89344c3

Please sign in to comment.