first commit
This commit is contained in:
24
internal/models/statistics.go
Normal file
24
internal/models/statistics.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type InterfaceType string
|
||||
|
||||
const (
|
||||
InterfaceTypeCLI InterfaceType = "CLI"
|
||||
InterfaceTypeWeb InterfaceType = "Web"
|
||||
)
|
||||
|
||||
type Statistics struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
Duration time.Duration `json:"duration"`
|
||||
|
||||
InterfaceType InterfaceType `json:"interface_type"`
|
||||
TasksCompleted int `json:"tasks_completed"`
|
||||
}
|
||||
26
internal/service/beads.go
Normal file
26
internal/service/beads.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/steveyegge/beads"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
beads.Storage
|
||||
}
|
||||
|
||||
func NewService(ctx context.Context, storage beads.Storage, prefix string) (*Service, error) {
|
||||
issue_prefix, err := storage.GetConfig(ctx, "issue_prefix")
|
||||
if err != nil || issue_prefix == "" {
|
||||
if err := storage.SetConfig(ctx, "issue_prefix", prefix); err != nil {
|
||||
return nil, fmt.Errorf("failed to set issue_prefix: %w", err)
|
||||
}
|
||||
fmt.Println("Initialized with prefix:", prefix)
|
||||
}
|
||||
|
||||
return &Service{
|
||||
Storage: storage,
|
||||
}, nil
|
||||
}
|
||||
13
internal/service/statistics.go
Normal file
13
internal/service/statistics.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package service
|
||||
|
||||
import "beadstest/internal/storage"
|
||||
|
||||
type StatisticsService struct {
|
||||
storage *storage.StatisticsStorage
|
||||
}
|
||||
|
||||
func NewStatisticsService(storage *storage.StatisticsStorage) *StatisticsService {
|
||||
return &StatisticsService{
|
||||
storage: storage,
|
||||
}
|
||||
}
|
||||
17
internal/storage/storage.go
Normal file
17
internal/storage/storage.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package storage
|
||||
|
||||
type StatisticsStorage struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
func NewStatisticsStorage(path string) *StatisticsStorage {
|
||||
return &StatisticsStorage{Path: path}
|
||||
}
|
||||
|
||||
func (s *StatisticsStorage) Save(stats any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *StatisticsStorage) Load() (any, error) {
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user