draftmail

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package draftmail contains the controller for the draft mail endpoint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(router *gin.Engine, database *mongo.Database, amqpService amqpinterfaces.AMQPServiceInterface)

SetupRoutes sets up the draft mail routes

func SetupRoutesWithMock

func SetupRoutesWithMock(router *gin.Engine, draftMailRepo repositories.DraftMailRepositoryInterface, userClient userclient.Interface, amqpService amqpinterfaces.AMQPServiceInterface, s3Service s3interfaces.S3ServiceInterface)

SetupRoutesWithMock sets up the draft mail routes with mock services for testing

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller handles draft mail related operations

func NewDraftMailController

func NewDraftMailController(draftMailRepo repositories.DraftMailRepositoryInterface, userClient userclient.Interface, amqpService amqpinterfaces.AMQPServiceInterface, s3Service s3interfaces.S3ServiceInterface) *Controller

NewDraftMailController creates a new draft mail controller instance

func (*Controller) CreateDraftMail

func (c *Controller) CreateDraftMail(ctx *gin.Context)

CreateDraftMail creates a new draft mail entry @Summary Create a new draft mail @Description Create a new draft mail entry with the provided mail data @Tags DraftMail @Accept json @Produce json @Param body body CreateDraftMailRequest true "Draft mail data" @Success 201 {object} models.SendMail @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft [post]

func (*Controller) DeleteDraftMail

func (c *Controller) DeleteDraftMail(ctx *gin.Context)

DeleteDraftMail soft deletes a draft mail by marking it as trashed @Summary Delete draft mail @Description Soft delete a draft mail by marking it as trashed @Tags DraftMail @Produce json @Param id path string true "Draft Mail ID" @Success 204 "No Content" @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft/{id} [delete]

func (*Controller) GetAllDraftMails

func (c *Controller) GetAllDraftMails(ctx *gin.Context)

GetAllDraftMails retrieves all draft mails for the authenticated user with pagination @Summary Get all draft mails @Description Get all draft mails for the authenticated user with pagination @Tags DraftMail @Produce json @Param page query int false "Page number (default: 1)" @Param size query int false "Number of items per page (default: 10, max: 100)" @Success 200 {object} PaginatedDraftMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft [get]

func (*Controller) GetDraftMailByID

func (c *Controller) GetDraftMailByID(ctx *gin.Context)

GetDraftMailByID retrieves a draft mail by its ID for the authenticated user @Summary Get draft mail by ID @Description Get a specific draft mail by its ID for the authenticated user @Tags DraftMail @Produce json @Param id path string true "Draft Mail ID" @Success 200 {object} models.SendMail @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft/{id} [get]

func (*Controller) GetDraftMailsSince added in v0.3.0

func (c *Controller) GetDraftMailsSince(ctx *gin.Context)

GetDraftMailsSince retrieves draft mails updated since a specific date for the authenticated user with pagination @Summary Get draft mails updated since date @Description Get draft mails updated since a specific date for the authenticated user with pagination @Tags DraftMail @Produce json @Param since query string true "Date in ISO8601 format (e.g., 2024-01-01T00:00:00Z)" @Param page query int false "Page number (default: 1)" @Param size query int false "Number of items per page (default: 10, max: 100)" @Success 200 {object} PaginatedDraftMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft/since [get]

func (*Controller) UpdateDraftMail

func (c *Controller) UpdateDraftMail(ctx *gin.Context)

UpdateDraftMail updates a draft mail entry @Summary Update a draft mail @Description Update a draft mail entry with the provided mail data @Tags DraftMail @Accept json @Produce json @Param id path string true "Draft Mail ID" @Param body body UpdateDraftMailRequest true "Draft mail data" @Success 200 {object} models.SendMail @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/draft/{id} [put]

type CreateDraftMailRequest

type CreateDraftMailRequest struct {
	Mail *models.Mail `json:"mail" binding:"required"`
}

CreateDraftMailRequest represents the request payload for creating a draft mail

type PaginatedDraftMailResponse

type PaginatedDraftMailResponse struct {
	DraftMails []*models.SendMail `json:"draft_mails"`
	TotalCount int64              `json:"total_count"`
	Page       int64              `json:"page,omitempty"`
	Size       int64              `json:"size,omitempty"`
	TotalPages int64              `json:"total_pages"`
}

PaginatedDraftMailResponse represents the paginated response for draft mails

type UpdateDraftMailRequest

type UpdateDraftMailRequest struct {
	Mail *models.Mail `json:"mail" binding:"required"`
}

UpdateDraftMailRequest represents the request payload for updating a draft mail

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL