@@ -13,7 +13,6 @@ import (
1313 "github.com/manchtools/power-manage/server/internal/eventtypes"
1414 "github.com/manchtools/power-manage/server/internal/eventtypes/payloads"
1515 "github.com/manchtools/power-manage/server/internal/store"
16- db "github.com/manchtools/power-manage/server/internal/store/generated"
1716)
1817
1918// ActionSetHandler handles action set RPCs.
@@ -68,7 +67,7 @@ func (h *ActionSetHandler) CreateActionSet(ctx context.Context, req *connect.Req
6867 return nil , err
6968 }
7069
71- set , err := h .store .Queries ().GetActionSetByID (ctx , id )
70+ set , err := h .store .Repos ().ActionSet . Get (ctx , id )
7271 if err != nil {
7372 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get action set" )
7473 }
@@ -84,12 +83,12 @@ func (h *ActionSetHandler) GetActionSet(ctx context.Context, req *connect.Reques
8483 return nil , err
8584 }
8685
87- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .Id )
86+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .Id )
8887 if err != nil {
8988 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
9089 }
9190
92- members , err := h .store .Queries ().ListActionSetMembers (ctx , req .Msg .Id )
91+ members , err := h .store .Repos ().ActionSet . ListMembers (ctx , req .Msg .Id )
9392 if err != nil {
9493 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get action set members" )
9594 }
@@ -117,16 +116,12 @@ func (h *ActionSetHandler) ListActionSets(ctx context.Context, req *connect.Requ
117116 return nil , err
118117 }
119118
120- sets , err := h .store .Queries ().ListActionSets (ctx , db.ListActionSetsParams {
121- Limit : pageSize ,
122- Offset : offset ,
123- UnassignedOnly : req .Msg .UnassignedOnly ,
124- })
119+ sets , err := h .store .Repos ().ActionSet .List (ctx , store.ListActionSetsFilter {Limit : pageSize , Offset : offset , UnassignedOnly : req .Msg .UnassignedOnly })
125120 if err != nil {
126121 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to list action sets" )
127122 }
128123
129- count , err := h .store .Queries ().CountActionSets (ctx , req .Msg .UnassignedOnly )
124+ count , err := h .store .Repos ().ActionSet . Count (ctx , req .Msg .UnassignedOnly )
130125 if err != nil {
131126 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to count action sets" )
132127 }
@@ -169,7 +164,7 @@ func (h *ActionSetHandler) RenameActionSet(ctx context.Context, req *connect.Req
169164 return nil , err
170165 }
171166
172- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .Id )
167+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .Id )
173168 if err != nil {
174169 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
175170 }
@@ -209,7 +204,7 @@ func (h *ActionSetHandler) UpdateActionSetSchedule(ctx context.Context, req *con
209204 return nil , err
210205 }
211206
212- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .Id )
207+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .Id )
213208 if err != nil {
214209 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
215210 }
@@ -243,7 +238,7 @@ func (h *ActionSetHandler) UpdateActionSetDescription(ctx context.Context, req *
243238 return nil , err
244239 }
245240
246- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .Id )
241+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .Id )
247242 if err != nil {
248243 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
249244 }
@@ -295,7 +290,7 @@ func (h *ActionSetHandler) AddActionToSet(ctx context.Context, req *connect.Requ
295290 }
296291
297292 // Verify set exists
298- _ , err = h .store .Queries ().GetActionSetByID (ctx , req .Msg .SetId )
293+ _ , err = h .store .Repos ().ActionSet . Get (ctx , req .Msg .SetId )
299294 if err != nil {
300295 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
301296 }
@@ -320,7 +315,7 @@ func (h *ActionSetHandler) AddActionToSet(ctx context.Context, req *connect.Requ
320315 return nil , err
321316 }
322317
323- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .SetId )
318+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .SetId )
324319 if err != nil {
325320 return nil , apiErrorCtx (ctx , ErrInternal , connect .CodeInternal , "failed to get action set" )
326321 }
@@ -360,7 +355,7 @@ func (h *ActionSetHandler) RemoveActionFromSet(ctx context.Context, req *connect
360355 return nil , err
361356 }
362357
363- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .SetId )
358+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .SetId )
364359 if err != nil {
365360 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
366361 }
@@ -401,7 +396,7 @@ func (h *ActionSetHandler) ReorderActionInSet(ctx context.Context, req *connect.
401396 return nil , err
402397 }
403398
404- set , err := h .store .Queries ().GetActionSetByID (ctx , req .Msg .SetId )
399+ set , err := h .store .Repos ().ActionSet . Get (ctx , req .Msg .SetId )
405400 if err != nil {
406401 return nil , handleGetError (ctx , err , ErrActionSetNotFound , "action set not found" )
407402 }
@@ -411,7 +406,7 @@ func (h *ActionSetHandler) ReorderActionInSet(ctx context.Context, req *connect.
411406 }), nil
412407}
413408
414- func (h * ActionSetHandler ) actionSetToProto (s db. ActionSetsProjection ) * pm.ActionSet {
409+ func (h * ActionSetHandler ) actionSetToProto (s store. ActionSet ) * pm.ActionSet {
415410 set := & pm.ActionSet {
416411 Id : s .ID ,
417412 Name : s .Name ,
0 commit comments