|
|
|
@@ -22,6 +22,7 @@ type ResourceSpecification struct { |
|
|
|
ShareMemGiB float32 |
|
|
|
UnitPrice int |
|
|
|
Status int |
|
|
|
IsAvailable bool |
|
|
|
IsAutomaticSync bool |
|
|
|
CreatedTime timeutil.TimeStamp `xorm:"created"` |
|
|
|
CreatedBy int64 |
|
|
|
@@ -40,6 +41,7 @@ func (r ResourceSpecification) ConvertToRes() *ResourceSpecificationRes { |
|
|
|
GPUMemGiB: r.GPUMemGiB, |
|
|
|
UnitPrice: r.UnitPrice, |
|
|
|
Status: r.Status, |
|
|
|
IsAvailable: r.IsAvailable, |
|
|
|
UpdatedTime: r.UpdatedTime, |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -72,6 +74,7 @@ func (r ResourceSpecificationReq) ToDTO() ResourceSpecification { |
|
|
|
IsAutomaticSync: r.IsAutomaticSync, |
|
|
|
CreatedBy: r.CreatorId, |
|
|
|
UpdatedBy: r.CreatorId, |
|
|
|
IsAvailable: true, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -113,6 +116,7 @@ type ResourceSpecificationRes struct { |
|
|
|
ShareMemGiB float32 |
|
|
|
UnitPrice int |
|
|
|
Status int |
|
|
|
IsAvailable bool |
|
|
|
UpdatedTime timeutil.TimeStamp |
|
|
|
} |
|
|
|
|
|
|
|
@@ -256,7 +260,7 @@ func SyncGrampusSpecs(updateList []ResourceSpecification, insertList []ResourceS |
|
|
|
return err |
|
|
|
} |
|
|
|
if len(deleteIds) > 0 { |
|
|
|
if _, err = sess.In("id", deleteIds).Update(&ResourceSpecification{Status: SpecOffShelf}); err != nil { |
|
|
|
if _, err = sess.In("id", deleteIds).Update(&ResourceSpecification{Status: SpecOffShelf, IsAvailable: false}); err != nil { |
|
|
|
return err |
|
|
|
} |
|
|
|
if _, err = sess.In("spec_id", deleteIds).Delete(&ResourceSceneSpec{}); err != nil { |
|
|
|
|