Skip to content

Commit

Permalink
Merge pull request #174 from Gongjakso/test/contest
Browse files Browse the repository at this point in the history
#171 feat : contest entity
  • Loading branch information
sycuuui authored Aug 15, 2024
2 parents 8658dca + ff9ea29 commit b98bed5
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.gongjakso.server.domain.contest.entity;

import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
@Getter
@NoArgsConstructor
@Entity
@Table(name = "contest")
public class Contest {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "contest_id",nullable = false,columnDefinition = "bigint")
private Long id;

@Column(name = "title",nullable = false,columnDefinition = "varchar(150)")
private String title;
@Column(name = "body",columnDefinition = "text")
private String body;
@Column(name = "contest_link",columnDefinition = "text")
private String contestLink;
@Column(name = "institution",columnDefinition = "varchar(100)")
private String institution;
@Column(name = "started_at",columnDefinition = "timestamp")
private LocalDate startedAt;
@Column(name = "finished_at",columnDefinition = "timestamp")
private LocalDate finishedAt;
@Column(name = "img_url",columnDefinition = "text")
private String imgUrl;

// public void update(UpdateContestDto contest,String imgUrl){
// this.title= (contest.title()==null) ? this.title : contest.title();
// this.body= (contest.body()==null) ? this.body : contest.body();
// this.contestLink= (contest.contestLink()==null) ? this.contestLink : contest.contestLink();
// this.institution= (contest.institution()==null) ? this.institution : contest.institution();
// this.startedAt= (contest.startedAt()==null) ? this.startedAt : contest.startedAt();
// this.finishedAt= (contest.finishedAt()==null) ? this.finishedAt : contest.finishedAt();
// this.imgUrl= (imgUrl==null) ? this.imgUrl : imgUrl;
// }

@Builder
public Contest(String title,String body,String contestLink,String institution,LocalDate startedAt,LocalDate finishedAt,String imgUrl){
this.title=title;
this.body=body;
this.contestLink=contestLink;
this.institution=institution;
this.startedAt=startedAt;
this.finishedAt=finishedAt;
this.imgUrl=imgUrl;
}
}

0 comments on commit b98bed5

Please sign in to comment.