diff --git a/internal/store/gorm/pareto.go b/internal/store/gorm/pareto.go new file mode 100644 index 0000000..bf9e5c2 --- /dev/null +++ b/internal/store/gorm/pareto.go @@ -0,0 +1,46 @@ +package gorm + +import ( + "context" + + "github.com/nicholaspcr/GoDE/pkg/api/v1" + "gorm.io/gorm" +) + +type paretoModel struct { + gorm.Model + UserID uint + User userModel `gorm:"foreignKey:UserID"` + + Vectors []vectorModel +} + +type paretoStore struct{ *gorm.DB } + +func newParetoStore(db *gorm.DB) *paretoStore { return &paretoStore{db} } + +func (st *paretoStore) CreatePareto( + ctx context.Context, usr *api.Pareto, +) error { + pareto := paretoModel{} + st.DB.WithContext(ctx).Create(&pareto) + return nil +} + +func (st *paretoStore) GetPareto( + ctx context.Context, usrIDs *api.ParetoIDs, +) (*api.Pareto, error) { + return nil, nil +} + +func (st *paretoStore) UpdatePareto( + ctx context.Context, usr *api.Pareto, fields ...string, +) error { + return nil +} + +func (st *paretoStore) DeletePareto( + ctx context.Context, usrIDs *api.ParetoIDs, +) error { + return nil +} diff --git a/internal/store/gorm/vector.go b/internal/store/gorm/vector.go new file mode 100644 index 0000000..1e1fdce --- /dev/null +++ b/internal/store/gorm/vector.go @@ -0,0 +1,44 @@ +package gorm + +import ( + "context" + + "github.com/nicholaspcr/GoDE/pkg/api/v1" + "gorm.io/gorm" +) + +type vectorModel struct { + gorm.Model + VectorID uint + Vector paretoModel `gorm:"foreignKey:VectorID"` +} + +type vectorStore struct{ *gorm.DB } + +func newVectorStore(db *gorm.DB) *vectorStore { return &vectorStore{db} } + +func (st *vectorStore) CreateVector( + ctx context.Context, usr *api.Vector, +) error { + vector := vectorModel{} + st.DB.WithContext(ctx).Create(&vector) + return nil +} + +func (st *vectorStore) GetVector( + ctx context.Context, usrIDs *api.VectorIDs, +) (*api.Vector, error) { + return nil, nil +} + +func (st *vectorStore) UpdateVector( + ctx context.Context, usr *api.Vector, fields ...string, +) error { + return nil +} + +func (st *vectorStore) DeleteVector( + ctx context.Context, usrIDs *api.VectorIDs, +) error { + return nil +} diff --git a/internal/store/interfaces.go b/internal/store/interfaces.go index 8d18e20..2abd6df 100644 --- a/internal/store/interfaces.go +++ b/internal/store/interfaces.go @@ -25,3 +25,12 @@ type TenantOperations interface { GetTenant(context.Context, *api.TenantIDs) (*api.Tenant, error) DeleteTenant(context.Context, *api.TenantIDs) error } + +// ParetoOperations is the interface for the pareto store. +type ParetoOperations interface { + CreatePareto(context.Context, *api.Pareto) error + GetPareto(context.Context, *api.ParetoIDs) error + UpdatePareto(context.Context, *api.Pareto) error + DeletePareto(context.Context, *api.Pareto) error + ListParetos(context.Context, *api.UserIDs) ([]*api.Pareto, error) +}