fix: critical bugs from code review (data corruption, error contract, HTTP hardening) #5

Merged
frx merged 7 commits from refactor/code-review-fixes into master 2026-06-28 14:04:25 +00:00
12 changed files with 97 additions and 52 deletions
Showing only changes of commit 0d2c4a7c3a - Show all commits

View File

@ -1,6 +0,0 @@
package domain
import "errors"
// ErrNotImplemented is returned by interface stubs that have not been implemented yet.
var ErrNotImplemented = errors.New("not implemented")

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"time" "time"
cerrors "git.loyso.art/frx/kurious/internal/common/errors"
"git.loyso.art/frx/kurious/internal/common/nullable" "git.loyso.art/frx/kurious/internal/common/nullable"
) )
@ -141,20 +142,20 @@ func (NotImplementedOrganizationRepository) ListStats(
context.Context, context.Context,
ListOrganizationsParams, ListOrganizationsParams,
) ([]OrganizationStat, error) { ) ([]OrganizationStat, error) {
return nil, ErrNotImplemented return nil, cerrors.ErrNotImplemented
} }
func (NotImplementedOrganizationRepository) List(context.Context, ListOrganizationsParams) ([]Organization, error) { func (NotImplementedOrganizationRepository) List(context.Context, ListOrganizationsParams) ([]Organization, error) {
return nil, ErrNotImplemented return nil, cerrors.ErrNotImplemented
} }
func (NotImplementedOrganizationRepository) Get(context.Context, GetOrganizationParams) (Organization, error) { func (NotImplementedOrganizationRepository) Get(context.Context, GetOrganizationParams) (Organization, error) {
return Organization{}, ErrNotImplemented return Organization{}, cerrors.ErrNotImplemented
} }
func (NotImplementedOrganizationRepository) Create(context.Context, CreateOrganizationParams) (Organization, error) { func (NotImplementedOrganizationRepository) Create(context.Context, CreateOrganizationParams) (Organization, error) {
return Organization{}, ErrNotImplemented return Organization{}, cerrors.ErrNotImplemented
} }
func (NotImplementedOrganizationRepository) Delete(ctx context.Context, id string) error { func (NotImplementedOrganizationRepository) Delete(ctx context.Context, id string) error {
return ErrNotImplemented return cerrors.ErrNotImplemented
} }
//go:generate mockery --name LearningCategoryRepository //go:generate mockery --name LearningCategoryRepository
@ -168,11 +169,11 @@ type LearningCategoryRepository interface {
type NotImplementedLearningCategory struct{} type NotImplementedLearningCategory struct{}
func (NotImplementedLearningCategory) Upsert(context.Context, LearningCategory) error { func (NotImplementedLearningCategory) Upsert(context.Context, LearningCategory) error {
return ErrNotImplemented return cerrors.ErrNotImplemented
} }
func (NotImplementedLearningCategory) List(context.Context) ([]LearningCategory, error) { func (NotImplementedLearningCategory) List(context.Context) ([]LearningCategory, error) {
return nil, ErrNotImplemented return nil, cerrors.ErrNotImplemented
} }
func (NotImplementedLearningCategory) Get(context.Context, string) (LearningCategory, error) { func (NotImplementedLearningCategory) Get(context.Context, string) (LearningCategory, error) {
return LearningCategory{}, ErrNotImplemented return LearningCategory{}, cerrors.ErrNotImplemented
} }