Improved validation on tag terms

This commit is contained in:
neviyn 2021-04-29 22:25:35 +01:00
parent c2e06354c2
commit 7ab9409ef0

View File

@ -8,6 +8,7 @@ import javax.persistence.JoinColumn
import javax.persistence.JoinTable
import javax.persistence.ManyToMany
import javax.persistence.ManyToOne
import javax.validation.constraints.Pattern
@Entity
open class User(
@ -56,6 +57,7 @@ open class Image(
@Entity
open class Tag(
@Column(unique = true)
@Pattern(regexp = "[a-zA-Z0-9_]*") // Only allow alphanumeric and underscores
open var tag: String = "",
@Id open var id: Long = -1
)