oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package setup
2
3import (
4 "amadan.net/oficina/equipo/internal/equipo/planning"
5 "amadan.net/oficina/equipo/internal/runnerproto"
6 "encoding/json"
7 "gorm.io/gorm"
8)
9
10func ConnectAccount(tx *gorm.DB, p runnerproto.RunnerPrincipal, a AccountSetup, q runnerproto.AccountSetupResult) (string, error) {
11 // Sign-in alone grants no model availability or containment certification.
12 report := runnerproto.ConnectionReport{LocalID: a.ID, Provider: a.Provider, ProviderVersion: q.ProviderVersion, Family: map[string]string{"codex": "gpt", "claude": "claude"}[a.Provider], Model: "pending", AccountLabel: a.Label, Kind: "subscription", UnavailableReason: "account_setup.waiting_report", Routing: runnerproto.ConnectionRouting{BindingID: a.ID, AccountID: q.AccountID}}
13 raw, err := json.Marshal([]runnerproto.ConnectionReport{report})
14 if err != nil {
15 return "", err
16 }
17 row := planning.ConnectionRecord{Connection: planning.Connection{ID: a.ID, LocalID: a.ID, RunnerID: p.RunnerID, Person: p.Person, Revision: 1}, ReportsJSON: string(raw)}
18 if err = tx.Create(&row).Error; err != nil {
19 return "", err
20 }
21 return row.ID, nil
22}
23