diff --git a/internal/controllers/http_controllers/account/account.go b/internal/controllers/http_controllers/account/account.go index 6ca1b07..bdf670f 100644 --- a/internal/controllers/http_controllers/account/account.go +++ b/internal/controllers/http_controllers/account/account.go @@ -350,6 +350,7 @@ func (r *Account) PostLeadTarget(ctx *fiber.Ctx) error { return nil } +// todo тут возможно стоит в будущем когда будет использоваться передавать еще и id ккаунта для большей четкости func (r *Account) DeleteLeadTarget(ctx *fiber.Ctx) error { leadIDStr := ctx.Params("id") leadID, err := strconv.ParseInt(leadIDStr, 10, 64) @@ -389,6 +390,7 @@ func (r *Account) GetLeadTarget(ctx *fiber.Ctx) error { return ctx.Status(fiber.StatusOK).JSON(result) } +// todo тут возможно стоит в будущем когда будет использоваться передавать еще и id ккаунта для большей четкости func (r *Account) UpdateLeadTarget(ctx *fiber.Ctx) error { var req struct { ID int64 `json:"id"` diff --git a/internal/controllers/http_controllers/question/question.go b/internal/controllers/http_controllers/question/question.go index e177cf1..1fa2986 100644 --- a/internal/controllers/http_controllers/question/question.go +++ b/internal/controllers/http_controllers/question/question.go @@ -36,6 +36,7 @@ type QuestionCreateReq struct { } // CreateQuestion service handler for creating question for quiz +// todo нужна проверка на то что квиз принадлежит пользователю, не помешает func (r *Question) CreateQuestion(ctx *fiber.Ctx) error { accountID, ok := middleware.GetAccountId(ctx) if !ok { @@ -117,6 +118,7 @@ type GetQuestionListResp struct { } // GetQuestionList handler for paginated list question +// todo нужна проверка на то что квиз принадлежит пользователю, не помешает func (r *Question) GetQuestionList(ctx *fiber.Ctx) error { var req GetQuestionListReq if err := ctx.BodyParser(&req); err != nil { @@ -178,6 +180,7 @@ type UpdateResp struct { } // UpdateQuestion handler for update question +// todo нужна проверка на то что квиз принадлежит пользователю, не помешает func (r *Question) UpdateQuestion(ctx *fiber.Ctx) error { var req UpdateQuestionReq if err := ctx.BodyParser(&req); err != nil { @@ -256,6 +259,7 @@ type CopyQuestionReq struct { } // CopyQuestion handler for copy question +// todo копирование может происходить с чужого опроса? если нет тоже проверку надо делать на принадлежность func (r *Question) CopyQuestion(ctx *fiber.Ctx) error { var req CopyQuestionReq if err := ctx.BodyParser(&req); err != nil { @@ -284,6 +288,7 @@ type GetQuestionHistoryReq struct { } // GetQuestionHistory handler for history of quiz +// todo нужна проверка на то что квиз принадлежит пользователю, не помешает func (r *Question) GetQuestionHistory(ctx *fiber.Ctx) error { var req GetQuestionHistoryReq if err := ctx.BodyParser(&req); err != nil { @@ -307,6 +312,7 @@ type DeactivateResp struct { } // DeleteQuestion handler for fake delete question +// todo нужна проверка на то что квиз принадлежит пользователю, не помешает func (r *Question) DeleteQuestion(ctx *fiber.Ctx) error { accountID, ok := middleware.GetAccountId(ctx) if !ok { diff --git a/internal/controllers/http_controllers/result/result.go b/internal/controllers/http_controllers/result/result.go index 5b8f930..6c250cf 100644 --- a/internal/controllers/http_controllers/result/result.go +++ b/internal/controllers/http_controllers/result/result.go @@ -6,8 +6,8 @@ import ( "gitea.pena/SQuiz/common/middleware" "gitea.pena/SQuiz/common/model" "gitea.pena/SQuiz/common/repository/result" - "github.com/gofiber/fiber/v2" "gitea.pena/SQuiz/core/internal/tools" + "github.com/gofiber/fiber/v2" "strconv" "time" ) @@ -41,6 +41,7 @@ type ReqExportResponse struct { Results []model.AnswerExport `json:"results"` } +// todo тут возможно такое что результат не принадлежит акаунту тк ид аккаунта не используется в запросе func (r *Result) GetResultsByQuizID(ctx *fiber.Ctx) error { payment := true // параметр для определения существования текущих привилегий юзера @@ -149,6 +150,7 @@ func (r *Result) SetStatus(ctx *fiber.Ctx) error { return ctx.Status(fiber.StatusOK).JSON(nil) } +// todo тоже не можем получить не относящиеся результаты к аккаунту так как имеем что то вроде проверки в GetQuizById func (r *Result) ExportResultsToCSV(ctx *fiber.Ctx) error { accountID, ok := middleware.GetAccountId(ctx) if !ok { @@ -210,6 +212,7 @@ func (r *Result) ExportResultsToCSV(ctx *fiber.Ctx) error { return ctx.Send(buffer.Bytes()) } +// todo возможна ситуация получения чужих результатов, нужна проверка от CheckResultOwner func (r *Result) GetResultAnswers(ctx *fiber.Ctx) error { accountID, ok := middleware.GetAccountId(ctx) if !ok { diff --git a/internal/controllers/http_controllers/statistic/statistic.go b/internal/controllers/http_controllers/statistic/statistic.go index 59de503..a1e4af9 100644 --- a/internal/controllers/http_controllers/statistic/statistic.go +++ b/internal/controllers/http_controllers/statistic/statistic.go @@ -24,6 +24,8 @@ func NewStatisticController(deps Deps) *Statistic { } } +// todo обсудить клиентские и админские методы, сделать проверки на принадлежность аккаунта - сущности + type DeviceStatReq struct { From uint64 // временные границы выбора статистики To uint64