blob: 232fa3ce2738b8e99b6470ce44e936d9ae8a27e6 (
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
33
34
|
package com.blog.web.dto;
import com.blog.web.models.UserEntity;
import jakarta.persistence.*;
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;
@ManyToOne
@JoinColumn(name = "created_by", nullable = false)
private UserEntity createdBy;
}
|