-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance job response structure: add organization details and implemen…
…t job retrieval by ID
- Loading branch information
1 parent
f58623a
commit 7da0723
Showing
6 changed files
with
123 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package messaging | ||
|
||
import ( | ||
"app/go-sso/internal/http/dto" | ||
"app/go-sso/internal/http/response" | ||
"app/go-sso/internal/repository" | ||
|
||
"github.com/google/uuid" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type IFindJobDataByIdMessageRequest struct { | ||
JobID uuid.UUID `json:"job_id"` | ||
} | ||
|
||
type IFindJobDataByIdMessageResponse struct { | ||
JobID uuid.UUID `json:"job_id"` | ||
Job *response.JobResponse `json:"job"` | ||
} | ||
|
||
type IFindJobDataByIdMessage interface { | ||
Execute(request IFindJobDataByIdMessageRequest) (*IFindJobDataByIdMessageResponse, error) | ||
} | ||
|
||
type FindJobDataByIdMessage struct { | ||
Log *logrus.Logger | ||
JobRepository repository.IJobRepository | ||
} | ||
|
||
func NewFindJobDataByIdMessage(log *logrus.Logger, jobRepository repository.IJobRepository) IFindJobDataByIdMessage { | ||
return &FindJobDataByIdMessage{ | ||
Log: log, | ||
JobRepository: jobRepository, | ||
} | ||
} | ||
|
||
func (m *FindJobDataByIdMessage) Execute(request IFindJobDataByIdMessageRequest) (*IFindJobDataByIdMessageResponse, error) { | ||
job, err := m.JobRepository.FindById(request.JobID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
jobResponse := dto.ConvertToSingleJobResponse(job) | ||
|
||
return &IFindJobDataByIdMessageResponse{ | ||
JobID: job.ID, | ||
Job: jobResponse, | ||
}, nil | ||
} | ||
|
||
func FindJobDataByIdMessageFactory(log *logrus.Logger) IFindJobDataByIdMessage { | ||
repository := repository.JobRepositoryFactory(log) | ||
return NewFindJobDataByIdMessage(log, repository) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters