Documentation
¶
Overview ¶
Package sendmail contains the controller for the send mail endpoint
Index ¶
- func SetupRoutes(router *gin.Engine, database *mongo.Database, ...)
- func SetupRoutesWithMock(router *gin.Engine, sendMailRepo repositories.SendMailRepositoryInterface, ...)
- type Controller
- func (c *Controller) CreateSendMail(ctx *gin.Context)
- func (c *Controller) DeleteSendMail(ctx *gin.Context)
- func (c *Controller) GetAllSendMails(ctx *gin.Context)
- func (c *Controller) GetSendMailByID(ctx *gin.Context)
- func (c *Controller) GetSendMailsSince(ctx *gin.Context)
- func (c *Controller) UpdateSendMailStatus(ctx *gin.Context)
- type CreateSendMailRequest
- type PaginatedSendMailResponse
- type UpdateSendMailStatusRequest
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 send mail routes
func SetupRoutesWithMock ¶
func SetupRoutesWithMock(router *gin.Engine, sendMailRepo repositories.SendMailRepositoryInterface, mailRepo repositories.MailRepositoryInterface, userClient userclient.Interface, amqpService amqpinterfaces.AMQPServiceInterface, s3Service s3interfaces.S3ServiceInterface)
SetupRoutesWithMock sets up the send mail routes with mock services for testing
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller handles send mail related operations
func NewSendMailController ¶
func NewSendMailController(sendMailRepo repositories.SendMailRepositoryInterface, mailRepo repositories.MailRepositoryInterface, userClient userclient.Interface, amqpService amqpinterfaces.AMQPServiceInterface, s3Service s3interfaces.S3ServiceInterface) *Controller
NewSendMailController creates a new send mail controller instance
func (*Controller) CreateSendMail ¶
func (c *Controller) CreateSendMail(ctx *gin.Context)
CreateSendMail creates a new send mail entry @Summary Create a new send mail @Description Create a new send mail entry with the provided mail data @Tags SendMail @Accept json @Produce json @Param body body CreateSendMailRequest true "Send 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/send [post]
func (*Controller) DeleteSendMail ¶
func (c *Controller) DeleteSendMail(ctx *gin.Context)
DeleteSendMail soft deletes a send mail by marking it as trashed @Summary Delete send mail @Description Soft delete a send mail by marking it as trashed @Tags SendMail @Produce json @Param id path string true "Send 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/send/{id} [delete]
func (*Controller) GetAllSendMails ¶
func (c *Controller) GetAllSendMails(ctx *gin.Context)
GetAllSendMails retrieves all send mails for the authenticated user with pagination @Summary Get all send mails @Description Get all send mails for the authenticated user with pagination @Tags SendMail @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} PaginatedSendMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/send [get]
func (*Controller) GetSendMailByID ¶
func (c *Controller) GetSendMailByID(ctx *gin.Context)
GetSendMailByID retrieves a send mail by its ID for the authenticated user @Summary Get send mail by ID @Description Get a specific send mail by its ID for the authenticated user @Tags SendMail @Produce json @Param id path string true "Send 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/send/{id} [get]
func (*Controller) GetSendMailsSince ¶ added in v0.4.0
func (c *Controller) GetSendMailsSince(ctx *gin.Context)
GetSendMailsSince retrieves send mails updated since a specific date for the authenticated user with pagination @Summary Get send mails updated since date @Description Get send mails updated since a specific date for the authenticated user with pagination @Tags SendMail @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} PaginatedSendMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/send/since [get]
func (*Controller) UpdateSendMailStatus ¶
func (c *Controller) UpdateSendMailStatus(ctx *gin.Context)
UpdateSendMailStatus updates the status of a send mail @Summary Update send mail status @Description Update the status of a send mail (pending, sent, failed) @Tags SendMail @Accept json @Produce json @Param id path string true "Send Mail ID" @Param body body UpdateSendMailStatusRequest true "Status update 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/send/{id}/status [patch]
type CreateSendMailRequest ¶
CreateSendMailRequest represents the request payload for creating a send mail
type PaginatedSendMailResponse ¶
type PaginatedSendMailResponse struct {
SendMails []*models.SendMail `json:"send_mails"`
TotalCount int64 `json:"total_count"`
Page int64 `json:"page,omitempty"`
Size int64 `json:"size,omitempty"`
TotalPages int64 `json:"total_pages,omitempty"`
}
PaginatedSendMailResponse represents the paginated response for send mails
type UpdateSendMailStatusRequest ¶
type UpdateSendMailStatusRequest struct {
Status models.SendStatus `json:"status" binding:"required"`
}
UpdateSendMailStatusRequest represents the request payload for updating send mail status