Skip to content

Commit 401ceaf

Browse files
committed
rename 'type' to 'resourceType' in ProjectAssetDTO and update queries accordingly
Signed-off-by: rafi <refaei.shikho@hotmail.com>
1 parent b64229e commit 401ceaf

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

database/repositories/project_repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (g *projectRepository) ListSubProjectsAndAssets(
129129
var q *gorm.DB
130130

131131
assetQuery := g.GetDB(ctx, tx).Model(&models.Asset{}).
132-
Select("'asset' AS type, id, name, slug, description, project_id, NULL::uuid AS parent_id, NULL::uuid AS organization_id, is_public, state, created_at, updated_at").
132+
Select("'asset' AS resource_type, id, name, slug, description, project_id, NULL::uuid AS parent_id, NULL::uuid AS organization_id, is_public, state, created_at, updated_at").
133133
Where("project_id = ?", parentID)
134134

135135
if len(allowedAssetIDs) > 0 {
@@ -139,7 +139,7 @@ func (g *projectRepository) ListSubProjectsAndAssets(
139139
}
140140

141141
projectQuery := g.GetDB(ctx, tx).Model(&models.Project{}).
142-
Select("'project' AS type, id, name, slug, description, NULL::uuid AS project_id, parent_id, organization_id, is_public, state, created_at, updated_at").
142+
Select("'project' AS resource_type, id, name, slug, description, NULL::uuid AS project_id, parent_id, organization_id, is_public, state, created_at, updated_at").
143143
Where("parent_id = ?", parentID)
144144

145145
if len(allowedProjectIDs) > 0 {

dtos/project_dto.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ type ProjectDetailsDTO struct {
7878
}
7979

8080
type ProjectAssetDTO struct {
81-
Type string `json:"type"` // "project" or "asset"
82-
ID uuid.UUID `json:"id"`
83-
Name string `json:"name"`
84-
Slug string `json:"slug"`
85-
Description string `json:"description"`
86-
ProjectID uuid.UUID `json:"projectId"`
87-
ParentID *uuid.UUID `json:"parentId,omitempty"` // only set for projects, not for assets
88-
IsPublic bool `json:"isPublic"`
89-
State string `json:"state"`
90-
CreatedAt time.Time `json:"createdAt"`
91-
UpdatedAt time.Time `json:"updatedAt"`
81+
ResourceType string `json:"resourceType"` // "project" or "asset"
82+
ID uuid.UUID `json:"id"`
83+
Name string `json:"name"`
84+
Slug string `json:"slug"`
85+
Description string `json:"description"`
86+
ProjectID uuid.UUID `json:"projectId"`
87+
ParentID *uuid.UUID `json:"parentId,omitempty"` // only set for projects, not for assets
88+
IsPublic bool `json:"isPublic"`
89+
State string `json:"state"`
90+
CreatedAt time.Time `json:"createdAt"`
91+
UpdatedAt time.Time `json:"updatedAt"`
9292
}

0 commit comments

Comments
 (0)