상세 컨텐츠

본문 제목

250213 TIL - AI 활용 비즈니스 프로젝트 - P1_Day2

Java 심화 3기 Spring boot camp

by Laika25 2025. 2. 13. 22:06

본문

오늘은 어제 작성한 API 명세서, 테이블 명세서, 인프라 설계도를 바탕으로한 멘토링과
프로젝트 진행을 위한 Git 컨벤션을 진행했다 
https://www.notion.so/Git-1992453ccc8f804597eceeb021aa6e10?pvs=4


이걸 바탕으로 내일 각자 담당하는 도메인의 디렉토리를 만들고 Entity부분을 채워오기로 했다 

팀원이 만든 레포지토리에 초대를 받아 접속하고 로컬로 복사했다 (난 Git Bash가 편하다 알록달록...)


내가 담당하는 부분의 브랜치를 만들고 


브랜치를 불러왔다


이제 디렉토리 세팅하고 
어제 작성한 테이블 명세서를 보고 Entity 채우면 된다
역시 계획을 잘 세우면 일이 편하다 




package com.p1.nomnom.store.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import lombok.*;
import java.time.LocalDateTime;
import java.util.UUID;

@Entity
@Table(name = "p_store")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Store {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private UUID id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "category_id", nullable = false)
    private Category category;

    @NotNull(message = "User ID cannot be null.")
    @Min(value = 1, message = "User ID must be greater than 0.")
    @Column(nullable = false)
    private Long userId;

    @NotBlank(message = "Store name cannot be blank.")
    @Size(max = 255, message = "Store name must not exceed 255 characters.")
    @Column(nullable = false)
    private String name;

    @NotBlank(message = "Address cannot be blank.")
    @Size(max = 255, message = "Address must not exceed 255 characters.")
    @Column(nullable = false)
    private String address;

    @NotBlank(message = "Phone number cannot be blank.")
    @Pattern(regexp = "\\d{2,4}-\\d{3,4}-\\d{4}", message = "Phone number format must be valid (e.g., 02-1234-5678).")
    @Column(nullable = false)
    private String phone;

    @NotBlank(message = "Open time cannot be blank.")
    @Column(nullable = false)
    private String openTime;

    @NotBlank(message = "Close time cannot be blank.")
    @Column(nullable = false)
    private String closeTime;

    @Column(nullable = false)
    private Boolean hidden = false;

    @Column(updatable = false, nullable = false)
    private LocalDateTime createdAt = LocalDateTime.now();

    @Column
    private LocalDateTime updatedAt;
}


package com.p1.nomnom.category.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import lombok.*;
import java.util.UUID;

@Entity
@Table(name = "p_category")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Category {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private UUID id;

    @NotBlank(message = "Category name cannot be blank.")
    @Size(max = 255, message = "Category name must not exceed 255 characters.")
    @Column(nullable = false, unique = true)
    private String name;

    @Size(max = 255, message = "Description must not exceed 255 characters.")
    @Column
    private String description;

    @Column(nullable = false)
    private Boolean hidden = false;
}



package com.p1.nomnom.ai.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import lombok.*;
import java.time.LocalDateTime;
import java.util.UUID;

@Entity
@Table(name = "p_ai")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AI {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private UUID id;

    @NotBlank(message = "Question cannot be blank.")
    @Size(max = 255, message = "Question must not exceed 255 characters.")
    @Column(nullable = false)
    private String question;

    @NotBlank(message = "Answer cannot be blank.")
    @Size(max = 255, message = "Answer must not exceed 255 characters.")
    @Column(nullable = false)
    private String answer;

    @NotBlank(message = "Food name cannot be blank.")
    @Size(max = 255, message = "Food name must not exceed 255 characters.")
    @Column(nullable = false)
    private String foodName;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "store_id", nullable = false)
    private Store store;

    @Size(max = 255, message = "Description hint must not exceed 255 characters.")
    @Column
    private String descriptionHint;

    @Size(max = 255, message = "Keyword must not exceed 255 characters.")
    @Column
    private String keyword;

    @Column(updatable = false, nullable = false)
    private LocalDateTime createdAt = LocalDateTime.now();
}


관련글 더보기