add addresse
This commit is contained in:
@@ -60,6 +60,11 @@ func NewLetterProcessor(letterRepo *repository.LetterIncomingRepository, attachR
|
||||
func (p *LetterProcessorImpl) CreateIncomingLetter(ctx context.Context, req *contract.CreateIncomingLetterRequest) (*contract.IncomingLetterResponse, error) {
|
||||
userID := appcontext.FromGinContext(ctx).UserID
|
||||
|
||||
letterType := entities.LetterIncomingTypeUtama
|
||||
if req.Type == "TEMBUSAN" {
|
||||
letterType = entities.LetterIncomingTypeTembusan
|
||||
}
|
||||
|
||||
entity := &entities.LetterIncoming{
|
||||
LetterNumber: req.LetterNumber,
|
||||
ReferenceNumber: req.ReferenceNumber,
|
||||
@@ -68,8 +73,10 @@ func (p *LetterProcessorImpl) CreateIncomingLetter(ctx context.Context, req *con
|
||||
PriorityID: req.PriorityID,
|
||||
SenderInstitutionID: req.SenderInstitutionID,
|
||||
SenderName: req.SenderName,
|
||||
Addressee: req.Addressee,
|
||||
ReceivedDate: req.ReceivedDate,
|
||||
DueDate: req.DueDate,
|
||||
Type: letterType,
|
||||
Status: entities.LetterIncomingStatusNew,
|
||||
CreatedBy: userID,
|
||||
}
|
||||
@@ -256,12 +263,18 @@ func (p *LetterProcessorImpl) UpdateIncomingLetter(ctx context.Context, id uuid.
|
||||
if req.SenderName != nil {
|
||||
entity.SenderName = req.SenderName
|
||||
}
|
||||
if req.Addressee != nil {
|
||||
entity.Addressee = req.Addressee
|
||||
}
|
||||
if req.ReceivedDate != nil {
|
||||
entity.ReceivedDate = *req.ReceivedDate
|
||||
}
|
||||
if req.DueDate != nil {
|
||||
entity.DueDate = req.DueDate
|
||||
}
|
||||
if req.Type != nil {
|
||||
entity.Type = entities.LetterIncomingType(*req.Type)
|
||||
}
|
||||
if req.Status != nil {
|
||||
entity.Status = entities.LetterIncomingStatus(*req.Status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user