go-todo-api/repositories/todo_repository.go
2025-12-02 18:58:25 +08:00

19 lines
621 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package repositories
import "go-todo-api/models"
type TodoRepository interface {
// ❗ 修正FindAll, FindByID, Delete 需要 userID 进行查询约束
FindAll(userID uint) ([]models.Todo, error)
FindByID(id uint, userID uint) (*models.Todo, error)
// ❗ 修正Create 不应包含 userID因为 Service 已经设置了 todo.UserID
Create(todo *models.Todo) error
// ❗ 修正Update 不应包含 userID因为 FindByID 已经完成了授权
Update(todo *models.Todo, input map[string]interface{}) error
// 修正Delete 需要 userID 进行查询约束
Delete(id uint, userID uint) error
}