feat(models): added new PostReport model
This commit is contained in:
parent
55f5795719
commit
797aaa3723
@ -2,7 +2,7 @@
|
||||
CREATE TYPE ReportType AS ENUM (
|
||||
'duplicate',
|
||||
'missing_data',
|
||||
'rating_abuse'
|
||||
'rating_abuse',
|
||||
'illegal_content'
|
||||
);
|
||||
|
||||
|
@ -26,7 +26,7 @@ const (
|
||||
UserFavoriteIsWrongLength = "userFavoriteID has the wrong length"
|
||||
|
||||
PostListIsEmpty = "userFavoriteList cannot be empty"
|
||||
PostIDIsEmpty = "userFavoriteID cannot be empty"
|
||||
PostIDIsEmpty = "PostID cannot be empty"
|
||||
PostIDIsWrongLength = "PostID has the wrong length"
|
||||
|
||||
BatchSizeIsEmpty = "batchSize cannot be empty"
|
||||
@ -38,6 +38,9 @@ const (
|
||||
|
||||
ScrapeTaskIDIsEmpty = "ScrapeTaskID cannot be empty"
|
||||
ScrapeTaskIDIsWrongLength = "ScrapeTaskID has the wrong length, needs to be 25 characters long"
|
||||
|
||||
PostReportIDIsEmpty = "PostReportID cannot be empty"
|
||||
PostReportIDIsWrongLength = "PostReportID has the wrong length"
|
||||
)
|
||||
|
||||
type EntityValidationFailed struct {
|
||||
|
@ -25,6 +25,10 @@ type (
|
||||
UserFavoriteID string
|
||||
|
||||
ScrapeTaskID string
|
||||
|
||||
PostReportID string
|
||||
ReportType string
|
||||
ReportState string
|
||||
)
|
||||
|
||||
const (
|
||||
@ -50,6 +54,21 @@ const (
|
||||
Copyright TagType = "copyright"
|
||||
)
|
||||
|
||||
const (
|
||||
Duplicate ReportType = "duplicate"
|
||||
MissingData ReportType = "missing_data"
|
||||
RatingAbuse ReportType = "rating_abuse"
|
||||
IllegalContent ReportType = "illegal_content"
|
||||
)
|
||||
|
||||
const (
|
||||
PendingUnclaimed ReportState = "pending_unclaimed"
|
||||
Pending ReportState = "pending"
|
||||
Approved ReportState = "approved"
|
||||
Partial ReportState = "partial"
|
||||
Rejected ReportState = "rejected"
|
||||
)
|
||||
|
||||
func (r *Rating) Convert(e621Rating string) {
|
||||
switch e621Rating {
|
||||
case "e":
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type ID interface {
|
||||
UserID | SourceID | PostID | UserSourceID | UserFavoriteID | PoolID
|
||||
UserID | SourceID | PostID | UserSourceID | UserFavoriteID | PoolID | PostReportID
|
||||
}
|
||||
|
||||
type BaseModel[T ID] struct {
|
||||
|
16
pkg/models/postReport.go
Normal file
16
pkg/models/postReport.go
Normal file
@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
type PostReport struct {
|
||||
BaseModel[PostReportID]
|
||||
PostID PostID `json:"post_id"`
|
||||
ReportBy UserID `json:"report_by"`
|
||||
ReportDescription string `json:"report_description"`
|
||||
AuditBy *UserID `json:"audit_by"`
|
||||
AuditDescription string `json:"audit_description"`
|
||||
ReportType ReportType `json:"report_type" gorm:"type:enum('duplicate','missing_data','rating_abuse','illegal_content')"`
|
||||
ReportState ReportState `json:"report_state" gorm:"type:enum('pending_unclaimed', 'pending', 'approved', 'partial', 'rejected')"`
|
||||
}
|
||||
|
||||
func (PostReport) TableName() string {
|
||||
return "PostReport"
|
||||
}
|
Loading…
Reference in New Issue
Block a user