add sender and receiver
This commit is contained in:
@@ -16,6 +16,7 @@ type LetterOutgoingProcessor interface {
|
||||
CreateOutgoingLetter(ctx context.Context, letter *entities.LetterOutgoing, attachments []entities.LetterOutgoingAttachment, userID, departmentID uuid.UUID) error
|
||||
GetOutgoingLetterByID(ctx context.Context, id uuid.UUID) (*entities.LetterOutgoing, error)
|
||||
ListOutgoingLetters(ctx context.Context, filter repository.ListOutgoingLettersFilter, limit, offset int) ([]entities.LetterOutgoing, int64, error)
|
||||
SearchOutgoingLetters(ctx context.Context, filters map[string]interface{}, page, limit int, sortBy, sortOrder string) ([]entities.LetterOutgoing, int64, error)
|
||||
UpdateOutgoingLetter(ctx context.Context, letter *entities.LetterOutgoing, userID uuid.UUID) error
|
||||
DeleteOutgoingLetter(ctx context.Context, id uuid.UUID, userID uuid.UUID) error
|
||||
|
||||
@@ -780,6 +781,11 @@ func (p *LetterOutgoingProcessorImpl) GetUsersByIDs(ctx context.Context, userIDs
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (p *LetterOutgoingProcessorImpl) SearchOutgoingLetters(ctx context.Context, filters map[string]interface{}, page, limit int, sortBy, sortOrder string) ([]entities.LetterOutgoing, int64, error) {
|
||||
offset := (page - 1) * limit
|
||||
return p.letterRepo.Search(ctx, filters, limit, offset, sortBy, sortOrder)
|
||||
}
|
||||
|
||||
func (p *LetterOutgoingProcessorImpl) BulkArchiveOutgoingLetters(ctx context.Context, letterIDs []uuid.UUID) (int64, error) {
|
||||
return p.letterRepo.BulkArchive(ctx, letterIDs)
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ func (p *LetterProcessorImpl) CreateIncomingLetter(ctx context.Context, req *con
|
||||
Description: req.Description,
|
||||
PriorityID: req.PriorityID,
|
||||
SenderInstitutionID: req.SenderInstitutionID,
|
||||
SenderName: req.SenderName,
|
||||
ReceivedDate: req.ReceivedDate,
|
||||
DueDate: req.DueDate,
|
||||
Status: entities.LetterIncomingStatusNew,
|
||||
@@ -252,6 +253,9 @@ func (p *LetterProcessorImpl) UpdateIncomingLetter(ctx context.Context, id uuid.
|
||||
if req.SenderInstitutionID != nil {
|
||||
entity.SenderInstitutionID = req.SenderInstitutionID
|
||||
}
|
||||
if req.SenderName != nil {
|
||||
entity.SenderName = req.SenderName
|
||||
}
|
||||
if req.ReceivedDate != nil {
|
||||
entity.ReceivedDate = *req.ReceivedDate
|
||||
}
|
||||
@@ -577,6 +581,11 @@ func (p *LetterProcessorImpl) createAttachments(ctx context.Context, letterID uu
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LetterProcessorImpl) SearchIncomingLetters(ctx context.Context, filters map[string]interface{}, page, limit int, sortBy, sortOrder string) ([]entities.LetterIncoming, int64, error) {
|
||||
offset := (page - 1) * limit
|
||||
return p.letterRepo.Search(ctx, filters, limit, offset, sortBy, sortOrder)
|
||||
}
|
||||
|
||||
func (p *LetterProcessorImpl) buildLetterResponse(ctx context.Context, entity *entities.LetterIncoming) (*contract.IncomingLetterResponse, error) {
|
||||
savedAttachments, _ := p.attachRepo.ListByLetter(ctx, entity.ID)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user