add AnswerService

This commit is contained in:
2026-09-17 02:38:05 +07:00
parent c70d839038
commit 87bd07019a
18 changed files with 448 additions and 304 deletions
+7 -7
View File
@@ -1,11 +1,11 @@
package app
import (
"evening_detective_server/internal/services/game_service"
"evening_detective_server/internal/services/answer_service"
proto "evening_detective_server/proto"
)
func mapAnswers(o []game_service.Answer) []*proto.Answer {
func mapAnswers(o []answer_service.Answer) []*proto.Answer {
res := make([]*proto.Answer, 0, len(o))
for _, item := range o {
res = append(res, &proto.Answer{
@@ -16,10 +16,10 @@ func mapAnswers(o []game_service.Answer) []*proto.Answer {
return res
}
func convertAnswers(o []*proto.Answer) []game_service.Answer {
res := make([]game_service.Answer, 0, len(o))
func convertAnswers(o []*proto.Answer) []answer_service.Answer {
res := make([]answer_service.Answer, 0, len(o))
for _, item := range o {
res = append(res, game_service.Answer{
res = append(res, answer_service.Answer{
QuestionCode: item.QuestionCode,
Text: item.Answer,
})
@@ -27,7 +27,7 @@ func convertAnswers(o []*proto.Answer) []game_service.Answer {
return res
}
func mapAnswerScores(o []game_service.AnswerScore) []*proto.AnswerScore {
func mapAnswerScores(o []answer_service.AnswerScore) []*proto.AnswerScore {
res := make([]*proto.AnswerScore, 0, len(o))
for _, item := range o {
score := &proto.AnswerScore{
@@ -43,7 +43,7 @@ func mapAnswerScores(o []game_service.AnswerScore) []*proto.AnswerScore {
return res
}
func mapTeamAnswers(o []game_service.TeamAnswers) []*proto.TeamAnswers {
func mapTeamAnswers(o []answer_service.TeamAnswers) []*proto.TeamAnswers {
res := make([]*proto.TeamAnswers, 0, len(o))
for _, item := range o {
res = append(res, &proto.TeamAnswers{