119 lines
4.9 KiB
Go
119 lines
4.9 KiB
Go
package models
|
|
|
|
type FieldType string
|
|
|
|
const (
|
|
FieldTypeText FieldType = "text"
|
|
FieldTypeDate FieldType = "date"
|
|
FieldTypeSelect FieldType = "select"
|
|
FieldTypeMasked FieldType = "masked"
|
|
)
|
|
|
|
type LocalizedString struct {
|
|
En string `json:"en"`
|
|
Ru string `json:"ru"`
|
|
It string `json:"it"`
|
|
}
|
|
|
|
type FieldOption struct {
|
|
Value string `json:"value"`
|
|
Label LocalizedString `json:"label"`
|
|
}
|
|
|
|
type FieldTemplate struct {
|
|
ID string `json:"id"`
|
|
Name LocalizedString `json:"name"`
|
|
Type FieldType `json:"type"`
|
|
Required bool `json:"required"`
|
|
Mask *string `json:"mask,omitempty"`
|
|
Options []FieldOption `json:"options,omitempty"`
|
|
Generated bool `json:"generated"`
|
|
}
|
|
|
|
type DocumentType struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
Code string `db:"code" json:"code"`
|
|
EmblemURL string `db:"emblem_url" json:"emblem_url"`
|
|
Color string `db:"color" json:"color"`
|
|
Fields []FieldTemplate `db:"fields" json:"fields"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
}
|
|
|
|
type DocumentApplicationStatus string
|
|
|
|
const (
|
|
ApplicationStatusPending DocumentApplicationStatus = "pending"
|
|
ApplicationStatusApproved DocumentApplicationStatus = "approved"
|
|
ApplicationStatusRejected DocumentApplicationStatus = "rejected"
|
|
)
|
|
|
|
type DocumentApplication struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
|
DocumentTypeID uuid.UUID `db:"document_type_id" json:"document_type_id"`
|
|
Status DocumentApplicationStatus `db:"status" json:"status"`
|
|
ReviewedBy *uuid.UUID `db:"reviewed_by" json:"reviewed_by,omitempty"`
|
|
ReviewedAt *time.Time `db:"reviewed_at" json:"reviewed_at,omitempty"`
|
|
RejectReason *string `db:"reject_reason" json:"reject_reason,omitempty"`
|
|
Data map[string]string `db:"data" json:"data"`
|
|
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
type DocumentApplicationLocalized struct {
|
|
ID uuid.UUID `json:"id"`
|
|
UserID uuid.UUID `json:"user_id"`
|
|
DocumentType DocumentType `json:"document_type"`
|
|
Status DocumentApplicationStatus `json:"status"`
|
|
ReviewedBy *uuid.UUID `json:"reviewed_by,omitempty"`
|
|
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
|
RejectReason *string `json:"reject_reason,omitempty"`
|
|
Data map[string]string `json:"data"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Document struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
UserID uuid.UUID `db:"user_id" json:"user_id"`
|
|
DocumentTypeID uuid.UUID `db:"document_type_id" json:"document_type_id"`
|
|
ApplicationID uuid.UUID `db:"application_id" json:"application_id"`
|
|
Number string `db:"number" json:"number"`
|
|
PhotoURL *string `db:"photo_url" json:"photo_url,omitempty"`
|
|
Data map[string]string `db:"data" json:"data"`
|
|
IssuedAt time.Time `db:"issued_at" json:"issued_at"`
|
|
RevokedAt *time.Time `db:"revoked_at" json:"revoked_at,omitempty"`
|
|
RevokedBy *uuid.UUID `db:"revoked_by" json:"revoked_by,omitempty"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
type DocumentLocalized struct {
|
|
ID uuid.UUID `json:"id"`
|
|
UserID uuid.UUID `json:"user_id"`
|
|
DocumentType DocumentType `json:"document_type"`
|
|
ApplicationID uuid.UUID `json:"application_id"`
|
|
Number string `json:"number"`
|
|
PhotoURL *string `json:"photo_url,omitempty"`
|
|
Data map[string]string `json:"data"`
|
|
IssuedAt time.Time `json:"issued_at"`
|
|
RevokedAt *time.Time `json:"revoked_at,omitempty"`
|
|
RevokedBy *uuid.UUID `json:"revoked_by,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type CreateDocumentApplicationInput struct {
|
|
DocumentTypeCode string `json:"document_type_code" binding:"required"`
|
|
Data map[string]string `json:"data" binding:"required"`
|
|
}
|
|
|
|
type ReviewDocumentApplicationInput struct {
|
|
Status DocumentApplicationStatus `json:"status" binding:"required"`
|
|
RejectReason *string `json:"reject_reason" binding:"omitempty"`
|
|
}
|
|
|
|
type RevokeDocumentInput struct {
|
|
DocumentID uuid.UUID `json:"document_id" binding:"required"`
|
|
} |