@@ -19,7 +19,9 @@ type NodePoolDao interface {
1919 Save (ctx context.Context , nodePool * api.NodePool ) error
2020 Delete (ctx context.Context , id string ) error
2121 FindByIDs (ctx context.Context , ids []string ) (api.NodePoolList , error )
22+ FindSoftDeletedByOwner (ctx context.Context , ownerID string ) (api.NodePoolList , error )
2223 SoftDeleteByOwner (ctx context.Context , ownerID string , t time.Time , deletedBy string ) error
24+ UpdateStatusConditionsByIDs (ctx context.Context , updates map [string ][]byte ) error
2325 All (ctx context.Context ) (api.NodePoolList , error )
2426}
2527
@@ -111,6 +113,15 @@ func (d *sqlNodePoolDao) SoftDeleteByOwner(ctx context.Context, ownerID string,
111113 return nil
112114}
113115
116+ func (d * sqlNodePoolDao ) FindSoftDeletedByOwner (ctx context.Context , ownerID string ) (api.NodePoolList , error ) {
117+ g2 := (* d .sessionFactory ).New (ctx )
118+ var nodePools api.NodePoolList
119+ if err := g2 .Where ("owner_id = ? AND deleted_time IS NOT NULL" , ownerID ).Find (& nodePools ).Error ; err != nil {
120+ return nil , err
121+ }
122+ return nodePools , nil
123+ }
124+
114125func (d * sqlNodePoolDao ) FindByIDs (ctx context.Context , ids []string ) (api.NodePoolList , error ) {
115126 g2 := (* d .sessionFactory ).New (ctx )
116127 nodePools := api.NodePoolList {}
@@ -120,6 +131,24 @@ func (d *sqlNodePoolDao) FindByIDs(ctx context.Context, ids []string) (api.NodeP
120131 return nodePools , nil
121132}
122133
134+ func (d * sqlNodePoolDao ) UpdateStatusConditionsByIDs (ctx context.Context , updates map [string ][]byte ) error {
135+ g2 := (* d .sessionFactory ).New (ctx )
136+ if len (updates ) == 0 {
137+ return nil
138+ }
139+
140+ for id , statusConditions := range updates {
141+ result := g2 .Model (& api.NodePool {}).
142+ Where ("id = ?" , id ).
143+ Update ("status_conditions" , statusConditions )
144+ if result .Error != nil {
145+ db .MarkForRollback (ctx , result .Error )
146+ return result .Error
147+ }
148+ }
149+ return nil
150+ }
151+
123152func (d * sqlNodePoolDao ) All (ctx context.Context ) (api.NodePoolList , error ) {
124153 g2 := (* d .sessionFactory ).New (ctx )
125154 nodePools := api.NodePoolList {}
0 commit comments