MSP-5186 Add /application/get_all endpoint

This commit is contained in:
Синельник Тимур Романович committed 2025-04-02 10:15:12 +03:00
1 parent f8fa58a09c
commit fa2f88c869
7 files changed
+182

No files matched your search

+13
View File
@@ -264,6 +264,19 @@ func (s Application) NextId(ctx context.Context) (int, error) {
return nextId, nil
}
func (s Application) GetAll(ctx context.Context) ([]domain.Application, error) {
apps, err := s.appRepo.GetAllApplications(ctx)
if err != nil {
return nil, errors.WithMessage(err, "get applications list")
}
result := make([]domain.Application, 0, len(apps))
for _, app := range apps {
result = append(result, s.convertApplication(app))
}
return result, nil
}
func (s Application) convertApplication(req entity.Application) domain.Application {
desc := ""
if req.Description != nil {
+1
View File
@@ -26,6 +26,7 @@ type ApplicationRepo interface {
CreateApplication(ctx context.Context, id int, name string, desc string, appGroupId int, appType string) (*entity.Application, error)
UpdateApplication(ctx context.Context, id int, name string, description string) (*entity.Application, error)
NextApplicationId(ctx context.Context) (int, error)
GetAllApplications(ctx context.Context) ([]entity.Application, error)
}
type AppGroupRepo interface {