return questiontype as string

This commit is contained in:
skeris 2024-04-11 19:26:02 +03:00
parent f16ff49215
commit 8e83ed89fa
5 changed files with 8 additions and 8 deletions

@ -280,7 +280,7 @@ WHERE privilege_name = $2
-- name: GetAllAnswersByQuizID :many
SELECT DISTINCT ON (a.question_id)
a.content, a.created_at, a.question_id, a.id, q.questiontype, quiz.qid
a.content, a.created_at, a.question_id, a.id, q.questiontype::Text as questiontype, quiz.qid
FROM
answer a
JOIN

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// sqlc v1.25.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// sqlc v1.25.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// sqlc v1.25.0
// source: queries.sql
package sqlcgen
@ -805,7 +805,7 @@ func (q *Queries) GetAccountWithPrivileges(ctx context.Context, userID sql.NullS
const getAllAnswersByQuizID = `-- name: GetAllAnswersByQuizID :many
SELECT DISTINCT ON (a.question_id)
a.content, a.created_at, a.question_id, a.id, q.questiontype, quiz.qid
a.content, a.created_at, a.question_id, a.id, q.questiontype::Text as questiontype, quiz.qid
FROM
answer a
JOIN
@ -823,7 +823,7 @@ type GetAllAnswersByQuizIDRow struct {
CreatedAt sql.NullTime `db:"created_at" json:"created_at"`
QuestionID int64 `db:"question_id" json:"question_id"`
ID int64 `db:"id" json:"id"`
Questiontype interface{} `db:"questiontype" json:"questiontype"`
Questiontype string `db:"questiontype" json:"questiontype"`
Qid uuid.NullUUID `db:"qid" json:"qid"`
}

@ -84,8 +84,8 @@ func (r *AnswerRepository) GetAllAnswersByQuizID(ctx context.Context, session st
}
for _, row := range rows {
if row.Questiontype.(string) == model.TypeFile {
if row.Questiontype == model.TypeFile {
fmt.Println("GALL", row.Qid, row.QuestionID, row.Content)
fileURL, err := r.answerMinio.GetAnswerURL(ctx, row.Qid.UUID.String(), row.QuestionID, row.Content.String)
if err != nil {
fmt.Println("GetAnswerURL dal answer minio answer", err)