Add init
This commit is contained in:
@@ -6,6 +6,12 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type DepartmentInfo struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code,omitempty"`
|
||||
}
|
||||
|
||||
type DispositionRouteResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
FromDepartmentID uuid.UUID `json:"from_department_id"`
|
||||
@@ -14,6 +20,10 @@ type DispositionRouteResponse struct {
|
||||
AllowedActions map[string]interface{} `json:"allowed_actions,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// Department information
|
||||
FromDepartment DepartmentInfo `json:"from_department"`
|
||||
ToDepartment DepartmentInfo `json:"to_department"`
|
||||
}
|
||||
|
||||
type CreateDispositionRouteRequest struct {
|
||||
|
||||
@@ -32,20 +32,20 @@ type IncomingLetterAttachmentResponse struct {
|
||||
}
|
||||
|
||||
type IncomingLetterResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
LetterNumber string `json:"letter_number"`
|
||||
ReferenceNumber *string `json:"reference_number,omitempty"`
|
||||
Subject string `json:"subject"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
PriorityID *uuid.UUID `json:"priority_id,omitempty"`
|
||||
SenderInstitutionID *uuid.UUID `json:"sender_institution_id,omitempty"`
|
||||
ReceivedDate time.Time `json:"received_date"`
|
||||
DueDate *time.Time `json:"due_date,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Attachments []IncomingLetterAttachmentResponse `json:"attachments"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
LetterNumber string `json:"letter_number"`
|
||||
ReferenceNumber *string `json:"reference_number,omitempty"`
|
||||
Subject string `json:"subject"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Priority *PriorityResponse `json:"priority,omitempty"`
|
||||
SenderInstitution *InstitutionResponse `json:"sender_institution,omitempty"`
|
||||
ReceivedDate time.Time `json:"received_date"`
|
||||
DueDate *time.Time `json:"due_date,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Attachments []IncomingLetterAttachmentResponse `json:"attachments"`
|
||||
}
|
||||
|
||||
type UpdateIncomingLetterRequest struct {
|
||||
@@ -77,6 +77,7 @@ type CreateDispositionActionSelection struct {
|
||||
}
|
||||
|
||||
type CreateLetterDispositionRequest struct {
|
||||
FromDepartment uuid.UUID `json:"from_department"`
|
||||
LetterID uuid.UUID `json:"letter_id"`
|
||||
ToDepartmentIDs []uuid.UUID `json:"to_department_ids"`
|
||||
Notes *string `json:"notes,omitempty"`
|
||||
@@ -84,20 +85,64 @@ type CreateLetterDispositionRequest struct {
|
||||
}
|
||||
|
||||
type DispositionResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
LetterID uuid.UUID `json:"letter_id"`
|
||||
FromDepartmentID *uuid.UUID `json:"from_department_id,omitempty"`
|
||||
ToDepartmentID *uuid.UUID `json:"to_department_id,omitempty"`
|
||||
Notes *string `json:"notes,omitempty"`
|
||||
Status string `json:"status"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
LetterID uuid.UUID `json:"letter_id"`
|
||||
DepartmentID *uuid.UUID `json:"department_id,omitempty"`
|
||||
Notes *string `json:"notes,omitempty"`
|
||||
ReadAt *time.Time `json:"read_at,omitempty"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ListDispositionsResponse struct {
|
||||
Dispositions []DispositionResponse `json:"dispositions"`
|
||||
}
|
||||
|
||||
type EnhancedDispositionResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
LetterID uuid.UUID `json:"letter_id"`
|
||||
DepartmentID *uuid.UUID `json:"department_id,omitempty"`
|
||||
Notes *string `json:"notes,omitempty"`
|
||||
ReadAt *time.Time `json:"read_at,omitempty"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Department DepartmentResponse `json:"department"`
|
||||
Departments []DispositionDepartmentResponse `json:"departments"`
|
||||
Actions []DispositionActionSelectionResponse `json:"actions"`
|
||||
DispositionNotes []DispositionNoteResponse `json:"disposition_notes"`
|
||||
}
|
||||
|
||||
type DispositionDepartmentResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
DepartmentID uuid.UUID `json:"department_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Department *DepartmentResponse `json:"department,omitempty"`
|
||||
}
|
||||
|
||||
type DispositionActionSelectionResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ActionID uuid.UUID `json:"action_id"`
|
||||
Action *DispositionActionResponse `json:"action,omitempty"`
|
||||
Note *string `json:"note,omitempty"`
|
||||
CreatedBy uuid.UUID `json:"created_by"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type DispositionNoteResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
UserID *uuid.UUID `json:"user_id,omitempty"`
|
||||
Note string `json:"note"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
User *UserResponse `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
type ListEnhancedDispositionsResponse struct {
|
||||
Dispositions []EnhancedDispositionResponse `json:"dispositions"`
|
||||
Discussions []LetterDiscussionResponse `json:"discussions"`
|
||||
}
|
||||
|
||||
type CreateLetterDiscussionRequest struct {
|
||||
ParentID *uuid.UUID `json:"parent_id,omitempty"`
|
||||
Message string `json:"message"`
|
||||
@@ -119,4 +164,10 @@ type LetterDiscussionResponse struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
EditedAt *time.Time `json:"edited_at,omitempty"`
|
||||
|
||||
// Preloaded user profile who created the discussion
|
||||
User *UserResponse `json:"user,omitempty"`
|
||||
|
||||
// Preloaded user profiles for mentions
|
||||
MentionedUsers []UserResponse `json:"mentioned_users,omitempty"`
|
||||
}
|
||||
|
||||
@@ -48,14 +48,15 @@ type LoginResponse struct {
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Roles []RoleResponse `json:"roles,omitempty"`
|
||||
Profile *UserProfileResponse `json:"profile,omitempty"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
IsActive bool `json:"is_active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Roles []RoleResponse `json:"roles,omitempty"`
|
||||
DepartmentResponse []DepartmentResponse `json:"department_response"`
|
||||
Profile *UserProfileResponse `json:"profile,omitempty"`
|
||||
}
|
||||
|
||||
type ListUsersRequest struct {
|
||||
@@ -128,3 +129,48 @@ type TitleResponse struct {
|
||||
type ListTitlesResponse struct {
|
||||
Titles []TitleResponse `json:"titles"`
|
||||
}
|
||||
|
||||
// MentionUsersRequest represents the request for getting users for mention purposes
|
||||
type MentionUsersRequest struct {
|
||||
Search *string `json:"search,omitempty" form:"search"` // Optional search term for username
|
||||
Limit *int `json:"limit,omitempty" form:"limit"` // Optional limit, defaults to 50, max 100
|
||||
}
|
||||
|
||||
// MentionUsersResponse represents the response for getting users for mention purposes
|
||||
type MentionUsersResponse struct {
|
||||
Users []UserResponse `json:"users"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// BulkCreateUsersRequest represents the request for creating multiple users
|
||||
type BulkCreateUsersRequest struct {
|
||||
Users []BulkUserRequest `json:"users" validate:"required,min=1,max=100"`
|
||||
}
|
||||
|
||||
// BulkUserRequest represents a single user in bulk creation request
|
||||
type BulkUserRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
Password string `json:"password" validate:"required,min=6"`
|
||||
Role string `json:"role" validate:"required"`
|
||||
}
|
||||
|
||||
// BulkCreateUsersResponse represents the response for bulk user creation
|
||||
type BulkCreateUsersResponse struct {
|
||||
Created []UserResponse `json:"created"`
|
||||
Failed []BulkUserErrorResult `json:"failed"`
|
||||
Summary BulkCreationSummary `json:"summary"`
|
||||
}
|
||||
|
||||
// BulkUserErrorResult represents a failed user creation with error details
|
||||
type BulkUserErrorResult struct {
|
||||
User BulkUserRequest `json:"user"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
// BulkCreationSummary provides summary of bulk creation results
|
||||
type BulkCreationSummary struct {
|
||||
Total int `json:"total"`
|
||||
Succeeded int `json:"succeeded"`
|
||||
Failed int `json:"failed"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type CreateVoteEventRequest struct {
|
||||
Title string `json:"title" validate:"required,min=1,max=255"`
|
||||
Description string `json:"description"`
|
||||
StartDate time.Time `json:"start_date" validate:"required"`
|
||||
EndDate time.Time `json:"end_date" validate:"required"`
|
||||
ResultsOpen *bool `json:"results_open,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateVoteEventRequest struct {
|
||||
Title string `json:"title" validate:"required,min=1,max=255"`
|
||||
Description string `json:"description"`
|
||||
StartDate time.Time `json:"start_date" validate:"required"`
|
||||
EndDate time.Time `json:"end_date" validate:"required"`
|
||||
IsActive bool `json:"is_active"`
|
||||
ResultsOpen *bool `json:"results_open,omitempty"`
|
||||
}
|
||||
|
||||
type VoteEventResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
StartDate time.Time `json:"start_date"`
|
||||
EndDate time.Time `json:"end_date"`
|
||||
IsActive bool `json:"is_active"`
|
||||
ResultsOpen bool `json:"results_open"`
|
||||
IsVotingOpen bool `json:"is_voting_open"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Candidates []CandidateResponse `json:"candidates,omitempty"`
|
||||
}
|
||||
|
||||
type ListVoteEventsRequest struct {
|
||||
Page int `json:"page" validate:"min=1"`
|
||||
Limit int `json:"limit" validate:"min=1,max=100"`
|
||||
}
|
||||
|
||||
type ListVoteEventsResponse struct {
|
||||
VoteEvents []VoteEventResponse `json:"vote_events"`
|
||||
Pagination PaginationResponse `json:"pagination"`
|
||||
}
|
||||
|
||||
type CreateCandidateRequest struct {
|
||||
VoteEventID uuid.UUID `json:"vote_event_id" validate:"required"`
|
||||
Name string `json:"name" validate:"required,min=1,max=255"`
|
||||
ImageURL string `json:"image_url"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type CandidateResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
VoteEventID uuid.UUID `json:"vote_event_id"`
|
||||
Name string `json:"name"`
|
||||
ImageURL string `json:"image_url"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
VoteCount int64 `json:"vote_count,omitempty"`
|
||||
}
|
||||
|
||||
type SubmitVoteRequest struct {
|
||||
VoteEventID uuid.UUID `json:"vote_event_id" validate:"required"`
|
||||
CandidateID uuid.UUID `json:"candidate_id" validate:"required"`
|
||||
}
|
||||
|
||||
type VoteResponse struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
VoteEventID uuid.UUID `json:"vote_event_id"`
|
||||
CandidateID uuid.UUID `json:"candidate_id"`
|
||||
UserID uuid.UUID `json:"user_id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type VoteResultsResponse struct {
|
||||
VoteEventID uuid.UUID `json:"vote_event_id"`
|
||||
Candidates []CandidateWithVotesResponse `json:"candidates"`
|
||||
TotalVotes int64 `json:"total_votes"`
|
||||
}
|
||||
|
||||
type CandidateWithVotesResponse struct {
|
||||
CandidateResponse
|
||||
VoteCount int64 `json:"vote_count"`
|
||||
}
|
||||
|
||||
type CheckVoteStatusResponse struct {
|
||||
HasVoted bool `json:"has_voted"`
|
||||
VotedAt *time.Time `json:"voted_at,omitempty"`
|
||||
CandidateID *uuid.UUID `json:"candidate_id,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user