refactor(api): refactor endpoints, services, and domain logic
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.about;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class About {
|
||||
private final AboutId id;
|
||||
private final String title;
|
||||
private final String description;
|
||||
private final String url;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.about;
|
||||
|
||||
public record AboutId(Long value) {
|
||||
public AboutId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("AboutId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.about.port;
|
||||
|
||||
import com.pablotj.portfolio.domain.about.About;
|
||||
import com.pablotj.portfolio.domain.about.AboutId;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface AboutRepositoryPort {
|
||||
|
||||
About save(About p);
|
||||
|
||||
Optional<About> findById(AboutId id);
|
||||
|
||||
List<About> findAll();
|
||||
}
|
||||
@@ -7,7 +7,8 @@ import lombok.Getter;
|
||||
@Builder
|
||||
public class Certification {
|
||||
private final CertificationId id;
|
||||
private final String title;
|
||||
private final String description;
|
||||
private final String url;
|
||||
private final String name;
|
||||
private final String issuer;
|
||||
private final String date;
|
||||
private final String credentialId;
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.pablotj.portfolio.domain.certification;
|
||||
|
||||
public record CertificationId(Long value) {
|
||||
public record CertificationId(Long profileId, Long certificationId) {
|
||||
|
||||
public CertificationId(Long profileId) {
|
||||
this(profileId, null);
|
||||
}
|
||||
|
||||
public CertificationId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("CertificationId must be positive");
|
||||
if (certificationId != null && certificationId < 0) throw new IllegalArgumentException("CertificationId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,5 @@ public interface CertificationRepositoryPort {
|
||||
|
||||
Optional<Certification> findById(CertificationId id);
|
||||
|
||||
List<Certification> findAll();
|
||||
List<Certification> findAll(Long profileId);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.contact;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class Contact {
|
||||
|
||||
private final ContactId id;
|
||||
private final String country;
|
||||
private final String city;
|
||||
private final String email;
|
||||
private final String phone;
|
||||
private final String linkedin;
|
||||
private final String github;
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.contact;
|
||||
|
||||
public record ContactId(Long value) {
|
||||
public ContactId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ContactId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.contact.port;
|
||||
|
||||
import com.pablotj.portfolio.domain.contact.Contact;
|
||||
import com.pablotj.portfolio.domain.contact.ContactId;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ContactRepositoryPort {
|
||||
Contact save(Contact p);
|
||||
|
||||
Optional<Contact> findById(ContactId id);
|
||||
|
||||
List<Contact> findAll();
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import lombok.Getter;
|
||||
@Builder
|
||||
public class Education {
|
||||
private final EducationId id;
|
||||
private final String title;
|
||||
private final String institution;
|
||||
private final String degree;
|
||||
private final String period;
|
||||
private final String grade;
|
||||
private final String description;
|
||||
private final String url;
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.pablotj.portfolio.domain.education;
|
||||
|
||||
public record EducationId(Long value) {
|
||||
public record EducationId(Long profileId, Long educationId) {
|
||||
public EducationId(Long profileId) {
|
||||
this(profileId, null);
|
||||
}
|
||||
|
||||
public EducationId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("EducationId must be positive");
|
||||
if (educationId != null && educationId < 0) throw new IllegalArgumentException("EducationId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,5 @@ public interface EducationRepositoryPort {
|
||||
|
||||
Optional<Education> findById(EducationId id);
|
||||
|
||||
List<Education> findAll();
|
||||
List<Education> findAll(Long profileId);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.pablotj.portfolio.domain.experience;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -9,15 +8,11 @@ import lombok.Getter;
|
||||
@Builder
|
||||
public class Experience {
|
||||
private final ExperienceId id;
|
||||
private final String position;
|
||||
private final String company;
|
||||
private final LocalDate startDate;
|
||||
private final LocalDate endDate;
|
||||
private final String city;
|
||||
private final String region;
|
||||
private final String country;
|
||||
private final Boolean remote;
|
||||
private final String position;
|
||||
private final String period;
|
||||
private final String location;
|
||||
private final String description;
|
||||
private final List<Skill> skills;
|
||||
private final List<Technology> technologies;
|
||||
private final List<Achievement> achievements;
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.pablotj.portfolio.domain.experience;
|
||||
|
||||
public record ExperienceId(Long value) {
|
||||
public record ExperienceId(Long profileId, Long experienceId) {
|
||||
|
||||
public ExperienceId(Long profileId) {
|
||||
this(profileId, null);
|
||||
}
|
||||
|
||||
public ExperienceId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ExperienceId must be positive");
|
||||
if (experienceId != null && experienceId < 0) throw new IllegalArgumentException("ProfileSocialLinkId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.pablotj.portfolio.domain.experience;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class Skill {
|
||||
private final SkillId id;
|
||||
public class Technology {
|
||||
private final TechnologyId id;
|
||||
private String name;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.pablotj.portfolio.domain.experience;
|
||||
|
||||
public record SkillId(Long value) {
|
||||
public SkillId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("SkillId must be positive");
|
||||
public record TechnologyId(Long value) {
|
||||
public TechnologyId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("TechnologyId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -10,5 +10,6 @@ public interface ExperienceRepositoryPort {
|
||||
|
||||
Optional<Experience> findById(ExperienceId id);
|
||||
|
||||
List<Experience> findAll();
|
||||
List<Experience> findAll(Long profileId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.pablotj.portfolio.domain.profile;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Singular;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class Profile {
|
||||
private final ProfileId id;
|
||||
private final String slug;
|
||||
private final String name;
|
||||
private final String title;
|
||||
private final String subtitle;
|
||||
private final String email;
|
||||
private final String phone;
|
||||
private final String location;
|
||||
private final String avatar;
|
||||
private final String bio;
|
||||
@Singular("social")
|
||||
private final List<ProfileSocialLink> social;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.pablotj.portfolio.domain.profile;
|
||||
|
||||
public record ProfileId(Long id, String slug) {
|
||||
|
||||
public ProfileId(Long id) {
|
||||
this(id, null);
|
||||
}
|
||||
|
||||
public ProfileId(String slug) {
|
||||
this(null, slug);
|
||||
}
|
||||
|
||||
public ProfileId {
|
||||
if (id != null && id < 0) throw new IllegalArgumentException("ProfileId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.pablotj.portfolio.domain.profile;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ProfileSocialLink {
|
||||
private final ProfileSocialLinkId id;
|
||||
private final String url;
|
||||
private final String platform;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.pablotj.portfolio.domain.profile;
|
||||
|
||||
public record ProfileSocialLinkId(Long value) {
|
||||
public ProfileSocialLinkId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ProfileSocialLinkId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.pablotj.portfolio.domain.profile.port;
|
||||
|
||||
import com.pablotj.portfolio.domain.profile.Profile;
|
||||
import com.pablotj.portfolio.domain.profile.ProfileId;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ProfileRepositoryPort {
|
||||
Profile save(Profile p);
|
||||
|
||||
Optional<Profile> findBySlug(ProfileId id);
|
||||
|
||||
Optional<Profile> findById(ProfileId id);
|
||||
|
||||
List<Profile> findAll();
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -9,5 +10,9 @@ public class Project {
|
||||
private final ProjectId id;
|
||||
private final String title;
|
||||
private final String description;
|
||||
private final String url;
|
||||
private final String image;
|
||||
private final List<ProjectTechnology> technologies;
|
||||
private final List<ProjectFeature> features;
|
||||
private final String demo;
|
||||
private final String repository;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ProjectFeature {
|
||||
private final ProjectFeatureId id;
|
||||
private final String name;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
public record ProjectFeatureId(Long value) {
|
||||
public ProjectFeatureId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ProjectFeatureId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
public record ProjectId(Long value) {
|
||||
public record ProjectId(Long profileId, Long projectId) {
|
||||
|
||||
public ProjectId(Long profileId) {
|
||||
this(profileId, null);
|
||||
}
|
||||
|
||||
public ProjectId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ProjectId must be positive");
|
||||
if (projectId != null && projectId < 0) throw new IllegalArgumentException("ProjectId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class ProjectTechnology {
|
||||
private final ProjectTechnologyId id;
|
||||
private final String name;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.pablotj.portfolio.domain.project;
|
||||
|
||||
public record ProjectTechnologyId(Long value) {
|
||||
public ProjectTechnologyId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ProjectTechnologyId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,5 @@ import java.util.Optional;
|
||||
public interface ProjectRepositoryPort {
|
||||
Project save(Project p);
|
||||
Optional<Project> findById(ProjectId id);
|
||||
List<Project> findAll();
|
||||
List<Project> findAll(Long profileId);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.resume;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class Resume {
|
||||
private final ResumeId id;
|
||||
private final String name;
|
||||
private final String surnames;
|
||||
private final String title;
|
||||
private final String summary;
|
||||
private final String icon;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.resume;
|
||||
|
||||
public record ResumeId(Long value) {
|
||||
public ResumeId {
|
||||
if (value != null && value < 0) throw new IllegalArgumentException("ResumeId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.pablotj.portfolio.domain.resume.port;
|
||||
|
||||
import com.pablotj.portfolio.domain.resume.Resume;
|
||||
import com.pablotj.portfolio.domain.resume.ResumeId;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface ResumeRepositoryPort {
|
||||
Resume save(Resume p);
|
||||
|
||||
Optional<Resume> findById(ResumeId id);
|
||||
|
||||
List<Resume> findAll();
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import lombok.Getter;
|
||||
@Builder
|
||||
public class Skill {
|
||||
private final SkillId id;
|
||||
private final String title;
|
||||
private final String description;
|
||||
private final String url;
|
||||
private final String name;
|
||||
private final Integer level;
|
||||
private final Integer years;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.pablotj.portfolio.domain.skill;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class SkillGroup {
|
||||
private final SkillGroupId id;
|
||||
private final String name;
|
||||
private final String icon;
|
||||
private final List<Skill> skills;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.pablotj.portfolio.domain.skill;
|
||||
|
||||
public record SkillGroupId(Long profileId, Long skillGroupId) {
|
||||
|
||||
public SkillGroupId(Long profileId) {
|
||||
this(profileId, null);
|
||||
}
|
||||
|
||||
public SkillGroupId {
|
||||
if (skillGroupId != null && skillGroupId < 0) throw new IllegalArgumentException("SkillId must be positive");
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.pablotj.portfolio.domain.skill.port;
|
||||
|
||||
import com.pablotj.portfolio.domain.skill.Skill;
|
||||
import com.pablotj.portfolio.domain.skill.SkillId;
|
||||
import com.pablotj.portfolio.domain.skill.SkillGroup;
|
||||
import com.pablotj.portfolio.domain.skill.SkillGroupId;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface SkillRepositoryPort {
|
||||
Skill save(Skill p);
|
||||
SkillGroup save(SkillGroup p);
|
||||
|
||||
Optional<Skill> findById(SkillId id);
|
||||
Optional<SkillGroup> findById(SkillGroupId id);
|
||||
|
||||
List<Skill> findAll();
|
||||
List<SkillGroup> findAll(Long profileId);
|
||||
}
|
||||
Reference in New Issue
Block a user