Skip to content

Commit

Permalink
enhancement(projects): added project data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
zZHorizonZz committed Jul 25, 2023
1 parent 9d13e6a commit 45e1a46
Show file tree
Hide file tree
Showing 23 changed files with 77 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.shiperist.entity;
package dev.shiperist.entity.account;

import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import jakarta.persistence.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package dev.shiperist.entity;
package dev.shiperist.entity.account;

import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.sql.Time;
import java.time.LocalDateTime;
import java.util.Date;

@Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package dev.shiperist.entity;
package dev.shiperist.entity.account;

import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.sql.Time;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package dev.shiperist.entity.project;

import io.quarkus.hibernate.reactive.panache.PanacheEntityBase;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@Entity(name = "Account")
@Table(name = "account", schema = "public")
@EqualsAndHashCode(callSuper = true)
public class ProjectEntity extends PanacheEntityBase {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;

@Column(name = "name")
private String name;

@Column(name = "display_name")
private String displayName;

@Column(name = "description")
private String description;

@Column(name = "image")
private String image;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import org.mapstruct.MapperConfig;

@MapperConfig(componentModel = "jakarta-cdi")
interface QuarkusMappingConfig {
public interface QuarkusMappingConfig {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.shiperist.mapper;
package dev.shiperist.mapper.account;

import dev.shiperist.entity.AccountEntity;
import dev.shiperist.model.Account;
import dev.shiperist.entity.account.AccountEntity;
import dev.shiperist.mapper.QuarkusMappingConfig;
import dev.shiperist.model.account.Account;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.shiperist.mapper;
package dev.shiperist.mapper.account;

import dev.shiperist.entity.SessionEntity;
import dev.shiperist.model.Session;
import dev.shiperist.entity.account.SessionEntity;
import dev.shiperist.mapper.QuarkusMappingConfig;
import dev.shiperist.model.account.Session;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dev.shiperist.mapper;
package dev.shiperist.mapper.account;

import dev.shiperist.entity.UserEntity;
import dev.shiperist.model.User;
import dev.shiperist.entity.account.UserEntity;
import dev.shiperist.mapper.QuarkusMappingConfig;
import dev.shiperist.model.account.User;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.model;
package dev.shiperist.model.account;

import dev.shiperist.entity.UserEntity;
import dev.shiperist.entity.account.UserEntity;
import lombok.Data;

@Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package dev.shiperist.model;
package dev.shiperist.model.account;

import dev.shiperist.entity.UserEntity;
import dev.shiperist.entity.account.UserEntity;
import lombok.Data;

import java.sql.Time;
import java.time.LocalDateTime;
import java.util.Date;

@Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package dev.shiperist.model;
package dev.shiperist.model.account;

import dev.shiperist.entity.AccountEntity;
import dev.shiperist.entity.SessionEntity;
import dev.shiperist.entity.account.AccountEntity;
import dev.shiperist.entity.account.SessionEntity;
import lombok.Data;

import java.sql.Time;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.shiperist.model;
package dev.shiperist.model.account;

import lombok.Data;

Expand Down
4 changes: 4 additions & 0 deletions server/src/main/java/dev/shiperist/model/project/Project.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.shiperist.model.project;

public class Project {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.repository;

import dev.shiperist.entity.AccountEntity;
import dev.shiperist.entity.account.AccountEntity;
import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase;
import io.quarkus.hibernate.reactive.panache.common.WithSession;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.repository;

import dev.shiperist.entity.SessionEntity;
import dev.shiperist.entity.account.SessionEntity;
import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase;
import io.quarkus.hibernate.reactive.panache.common.WithSession;
import io.smallrye.mutiny.Uni;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.repository;

import dev.shiperist.entity.UserEntity;
import dev.shiperist.entity.account.UserEntity;
import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase;
import io.quarkus.hibernate.reactive.panache.common.WithSession;
import io.smallrye.mutiny.Uni;
Expand Down
3 changes: 1 addition & 2 deletions server/src/main/java/dev/shiperist/resource/AuthService.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.resource;

import dev.shiperist.model.User;
import dev.shiperist.model.account.User;
import dev.shiperist.service.AccountService;
import dev.shiperist.service.SessionService;
import dev.shiperist.service.UserService;
Expand All @@ -11,7 +11,6 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.shiperist.resource;

public class ProjectResource {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist.security;

import dev.shiperist.model.User;
import dev.shiperist.model.account.User;
import dev.shiperist.service.SessionService;
import dev.shiperist.service.UserService;
import io.quarkus.security.AuthenticationFailedException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.shiperist.service;

import dev.shiperist.entity.AccountEntity;
import dev.shiperist.mapper.AccountMapper;
import dev.shiperist.model.Account;
import dev.shiperist.entity.account.AccountEntity;
import dev.shiperist.mapper.account.AccountMapper;
import dev.shiperist.model.account.Account;
import dev.shiperist.repository.AccountRepository;
import io.quarkus.hibernate.reactive.panache.common.WithTransaction;
import io.smallrye.mutiny.Uni;
Expand Down
10 changes: 4 additions & 6 deletions server/src/main/java/dev/shiperist/service/SessionService.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.shiperist.service;

import dev.shiperist.entity.SessionEntity;
import dev.shiperist.mapper.SessionMapper;
import dev.shiperist.model.Session;
import dev.shiperist.model.User;
import dev.shiperist.entity.account.SessionEntity;
import dev.shiperist.mapper.account.SessionMapper;
import dev.shiperist.model.account.Session;
import dev.shiperist.model.account.User;
import dev.shiperist.repository.SessionRepository;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
Expand All @@ -14,9 +14,7 @@
import jakarta.inject.Inject;

import java.security.Key;
import java.sql.Time;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.Optional;
Expand Down
6 changes: 3 additions & 3 deletions server/src/main/java/dev/shiperist/service/UserService.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.shiperist.service;

import at.favre.lib.crypto.bcrypt.BCrypt;
import dev.shiperist.entity.UserEntity;
import dev.shiperist.mapper.UserMapper;
import dev.shiperist.model.User;
import dev.shiperist.entity.account.UserEntity;
import dev.shiperist.mapper.account.UserMapper;
import dev.shiperist.model.account.User;
import dev.shiperist.repository.UserRepository;
import io.quarkus.hibernate.reactive.panache.common.WithTransaction;
import io.smallrye.mutiny.Uni;
Expand Down
2 changes: 1 addition & 1 deletion server/src/test/java/dev/shiperist/AuthResourceTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.shiperist;

import dev.shiperist.model.User;
import dev.shiperist.model.account.User;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;
Expand Down

0 comments on commit 45e1a46

Please sign in to comment.