added todo
This commit is contained in:
parent
73a861b71d
commit
4aee7e6cd9
@ -350,6 +350,7 @@ func (r *Account) PostLeadTarget(ctx *fiber.Ctx) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo тут возможно стоит в будущем когда будет использоваться передавать еще и id ккаунта для большей четкости
|
||||||
func (r *Account) DeleteLeadTarget(ctx *fiber.Ctx) error {
|
func (r *Account) DeleteLeadTarget(ctx *fiber.Ctx) error {
|
||||||
leadIDStr := ctx.Params("id")
|
leadIDStr := ctx.Params("id")
|
||||||
leadID, err := strconv.ParseInt(leadIDStr, 10, 64)
|
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)
|
return ctx.Status(fiber.StatusOK).JSON(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo тут возможно стоит в будущем когда будет использоваться передавать еще и id ккаунта для большей четкости
|
||||||
func (r *Account) UpdateLeadTarget(ctx *fiber.Ctx) error {
|
func (r *Account) UpdateLeadTarget(ctx *fiber.Ctx) error {
|
||||||
var req struct {
|
var req struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
|
@ -36,6 +36,7 @@ type QuestionCreateReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateQuestion service handler for creating question for quiz
|
// CreateQuestion service handler for creating question for quiz
|
||||||
|
// todo нужна проверка на то что квиз принадлежит пользователю, не помешает
|
||||||
func (r *Question) CreateQuestion(ctx *fiber.Ctx) error {
|
func (r *Question) CreateQuestion(ctx *fiber.Ctx) error {
|
||||||
accountID, ok := middleware.GetAccountId(ctx)
|
accountID, ok := middleware.GetAccountId(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -117,6 +118,7 @@ type GetQuestionListResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetQuestionList handler for paginated list question
|
// GetQuestionList handler for paginated list question
|
||||||
|
// todo нужна проверка на то что квиз принадлежит пользователю, не помешает
|
||||||
func (r *Question) GetQuestionList(ctx *fiber.Ctx) error {
|
func (r *Question) GetQuestionList(ctx *fiber.Ctx) error {
|
||||||
var req GetQuestionListReq
|
var req GetQuestionListReq
|
||||||
if err := ctx.BodyParser(&req); err != nil {
|
if err := ctx.BodyParser(&req); err != nil {
|
||||||
@ -178,6 +180,7 @@ type UpdateResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateQuestion handler for update question
|
// UpdateQuestion handler for update question
|
||||||
|
// todo нужна проверка на то что квиз принадлежит пользователю, не помешает
|
||||||
func (r *Question) UpdateQuestion(ctx *fiber.Ctx) error {
|
func (r *Question) UpdateQuestion(ctx *fiber.Ctx) error {
|
||||||
var req UpdateQuestionReq
|
var req UpdateQuestionReq
|
||||||
if err := ctx.BodyParser(&req); err != nil {
|
if err := ctx.BodyParser(&req); err != nil {
|
||||||
@ -256,6 +259,7 @@ type CopyQuestionReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CopyQuestion handler for copy question
|
// CopyQuestion handler for copy question
|
||||||
|
// todo копирование может происходить с чужого опроса? если нет тоже проверку надо делать на принадлежность
|
||||||
func (r *Question) CopyQuestion(ctx *fiber.Ctx) error {
|
func (r *Question) CopyQuestion(ctx *fiber.Ctx) error {
|
||||||
var req CopyQuestionReq
|
var req CopyQuestionReq
|
||||||
if err := ctx.BodyParser(&req); err != nil {
|
if err := ctx.BodyParser(&req); err != nil {
|
||||||
@ -284,6 +288,7 @@ type GetQuestionHistoryReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetQuestionHistory handler for history of quiz
|
// GetQuestionHistory handler for history of quiz
|
||||||
|
// todo нужна проверка на то что квиз принадлежит пользователю, не помешает
|
||||||
func (r *Question) GetQuestionHistory(ctx *fiber.Ctx) error {
|
func (r *Question) GetQuestionHistory(ctx *fiber.Ctx) error {
|
||||||
var req GetQuestionHistoryReq
|
var req GetQuestionHistoryReq
|
||||||
if err := ctx.BodyParser(&req); err != nil {
|
if err := ctx.BodyParser(&req); err != nil {
|
||||||
@ -307,6 +312,7 @@ type DeactivateResp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteQuestion handler for fake delete question
|
// DeleteQuestion handler for fake delete question
|
||||||
|
// todo нужна проверка на то что квиз принадлежит пользователю, не помешает
|
||||||
func (r *Question) DeleteQuestion(ctx *fiber.Ctx) error {
|
func (r *Question) DeleteQuestion(ctx *fiber.Ctx) error {
|
||||||
accountID, ok := middleware.GetAccountId(ctx)
|
accountID, ok := middleware.GetAccountId(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"gitea.pena/SQuiz/common/middleware"
|
"gitea.pena/SQuiz/common/middleware"
|
||||||
"gitea.pena/SQuiz/common/model"
|
"gitea.pena/SQuiz/common/model"
|
||||||
"gitea.pena/SQuiz/common/repository/result"
|
"gitea.pena/SQuiz/common/repository/result"
|
||||||
"github.com/gofiber/fiber/v2"
|
|
||||||
"gitea.pena/SQuiz/core/internal/tools"
|
"gitea.pena/SQuiz/core/internal/tools"
|
||||||
|
"github.com/gofiber/fiber/v2"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -41,6 +41,7 @@ type ReqExportResponse struct {
|
|||||||
Results []model.AnswerExport `json:"results"`
|
Results []model.AnswerExport `json:"results"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo тут возможно такое что результат не принадлежит акаунту тк ид аккаунта не используется в запросе
|
||||||
func (r *Result) GetResultsByQuizID(ctx *fiber.Ctx) error {
|
func (r *Result) GetResultsByQuizID(ctx *fiber.Ctx) error {
|
||||||
payment := true // параметр для определения существования текущих привилегий юзера
|
payment := true // параметр для определения существования текущих привилегий юзера
|
||||||
|
|
||||||
@ -149,6 +150,7 @@ func (r *Result) SetStatus(ctx *fiber.Ctx) error {
|
|||||||
return ctx.Status(fiber.StatusOK).JSON(nil)
|
return ctx.Status(fiber.StatusOK).JSON(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo тоже не можем получить не относящиеся результаты к аккаунту так как имеем что то вроде проверки в GetQuizById
|
||||||
func (r *Result) ExportResultsToCSV(ctx *fiber.Ctx) error {
|
func (r *Result) ExportResultsToCSV(ctx *fiber.Ctx) error {
|
||||||
accountID, ok := middleware.GetAccountId(ctx)
|
accountID, ok := middleware.GetAccountId(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -210,6 +212,7 @@ func (r *Result) ExportResultsToCSV(ctx *fiber.Ctx) error {
|
|||||||
return ctx.Send(buffer.Bytes())
|
return ctx.Send(buffer.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo возможна ситуация получения чужих результатов, нужна проверка от CheckResultOwner
|
||||||
func (r *Result) GetResultAnswers(ctx *fiber.Ctx) error {
|
func (r *Result) GetResultAnswers(ctx *fiber.Ctx) error {
|
||||||
accountID, ok := middleware.GetAccountId(ctx)
|
accountID, ok := middleware.GetAccountId(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -24,6 +24,8 @@ func NewStatisticController(deps Deps) *Statistic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo обсудить клиентские и админские методы, сделать проверки на принадлежность аккаунта - сущности
|
||||||
|
|
||||||
type DeviceStatReq struct {
|
type DeviceStatReq struct {
|
||||||
From uint64 // временные границы выбора статистики
|
From uint64 // временные границы выбора статистики
|
||||||
To uint64
|
To uint64
|
||||||
|
Loading…
Reference in New Issue
Block a user