summaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/blog/web/dto/ArticleDto.java
blob: 0c48f622ff1e6ac4f2cca69ccc6588d8f9cd8eaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.blog.web.dto;

import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotEmpty;
import lombok.Builder;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.hibernate.validator.constraints.URL;

import java.time.LocalDateTime;

@Data
@Builder
public class ArticleDto {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @NotEmpty(message = "Article title should not be empty")
    private String title;
    @NotEmpty(message = "Article Photo URL should not be empty")
    @URL(message = "Article Photo URL should be a URL")
    private String photoUrl;
    @NotEmpty(message = "Article Content should not be empty")
    private String content;
    @CreationTimestamp
    private LocalDateTime createdOn;
    @UpdateTimestamp
    private LocalDateTime updatedOn;
}