Download this file
| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | |
| 6 | "amadan.net/oficina/equipo/internal/equipo/library" |
| 7 | "gorm.io/gorm" |
| 8 | ) |
| 9 | |
| 10 | func seedSpecialists(tx *gorm.DB) (int64, error) { |
| 11 | var t Team |
| 12 | if err := tx.First(&t).Error; err != nil { |
| 13 | return 0, err |
| 14 | } |
| 15 | return library.Seed(tx, t.ID) |
| 16 | } |
| 17 | func (s *Store) Specialists(ctx context.Context) ([]Specialist, error) { |
| 18 | if s == nil || s.db == nil { |
| 19 | return nil, ErrUnavailable |
| 20 | } |
| 21 | rows, err := library.ListInstance(s.db.G.WithContext(ctx)) |
| 22 | return rows, storeError(err) |
| 23 | } |
| 24 | |
| 25 | func (s *Store) SaveSpecialist(ctx context.Context, actor Actor, row Specialist) error { |
| 26 | return s.write(ctx, func(tx *gorm.DB) error { return s.libraryAt(tx).SaveLegacy(actor, row) }) |
| 27 | } |
| 28 | |