You've already forked agentic-coding-workflow
feat(config,workspace,user): jobs/notify config + workspace fetch repo + user ListAdmins
This commit is contained in:
@@ -57,6 +57,11 @@ type Repository interface {
|
||||
FinishPruneSuccess(ctx context.Context, id uuid.UUID) error
|
||||
FinishPruneRollback(ctx context.Context, id uuid.UUID) error
|
||||
|
||||
// Workspace fetch (jobs runner)
|
||||
ListFetchTargets(ctx context.Context) ([]FetchTarget, error)
|
||||
MarkSyncing(ctx context.Context, id uuid.UUID) (bool, error)
|
||||
MarkFetchResult(ctx context.Context, id uuid.UUID, success bool, errMsg string) error
|
||||
|
||||
// Credential
|
||||
UpsertCredential(ctx context.Context, c *Credential) (*Credential, error)
|
||||
GetCredentialByWorkspace(ctx context.Context, wsID uuid.UUID) (*Credential, error)
|
||||
@@ -242,6 +247,49 @@ func (r *pgRepo) ResetStuckSyncStatuses(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ===== Workspace fetch (jobs runner) =====
|
||||
|
||||
func (r *pgRepo) ListFetchTargets(ctx context.Context) ([]FetchTarget, error) {
|
||||
rows, err := r.q.ListFetchTargets(ctx)
|
||||
if err != nil {
|
||||
return nil, errs.Wrap(err, errs.CodeInternal, "list fetch targets")
|
||||
}
|
||||
out := make([]FetchTarget, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
out = append(out, FetchTarget{
|
||||
ID: fromPgUUID(row.ID),
|
||||
OwnerID: fromPgUUID(row.OwnerID),
|
||||
Name: row.Name,
|
||||
MainPath: row.MainPath,
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (r *pgRepo) MarkSyncing(ctx context.Context, id uuid.UUID) (bool, error) {
|
||||
n, err := r.q.MarkSyncingCAS(ctx, toPgUUID(id))
|
||||
if err != nil {
|
||||
return false, errs.Wrap(err, errs.CodeInternal, "mark syncing")
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
func (r *pgRepo) MarkFetchResult(ctx context.Context, id uuid.UUID, success bool, errMsg string) error {
|
||||
var lastErr *string
|
||||
if errMsg != "" {
|
||||
lastErr = &errMsg
|
||||
}
|
||||
err := r.q.MarkFetchResult(ctx, workspacesqlc.MarkFetchResultParams{
|
||||
ID: toPgUUID(id),
|
||||
Column2: success,
|
||||
LastSyncError: lastErr,
|
||||
})
|
||||
if err != nil {
|
||||
return errs.Wrap(err, errs.CodeInternal, "mark fetch result")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ===== Worktree =====
|
||||
|
||||
func rowToWorktree(r workspacesqlc.WorkspaceWorktree) *Worktree {
|
||||
|
||||
Reference in New Issue
Block a user