Skip to content

Commit

Permalink
[INIT] 폴더 도메인
Browse files Browse the repository at this point in the history
  • Loading branch information
Chan531 committed Oct 23, 2024
1 parent 3cf4f22 commit 7889360
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/main/java/com/tiki/server/folder/entity/Folder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.tiki.server.folder.entity;

import static jakarta.persistence.GenerationType.IDENTITY;

import com.tiki.server.common.entity.BaseTime;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor
public class Folder extends BaseTime {

@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;

private String name;

private String path;

private long teamId;

public Folder(String name, Folder parentFolder, long teamId) {
this.name = name;
this.path = generatePath(parentFolder);
this.teamId = teamId;
}

private String generatePath(Folder parentFolder) {
if (parentFolder == null) {
return "";
}
return parentFolder.getPath() + "/" + parentFolder.getId();
}
}

0 comments on commit 7889360

Please sign in to comment.