From 8707b0909bb029c9f622a359d68ddbf0f0dc631c Mon Sep 17 00:00:00 2001 From: Contextualist Date: Thu, 15 Aug 2024 18:44:09 -0700 Subject: [PATCH] feat: include field PrsnAppearEps in subject persons response (#616) --- domain/relation.go | 1 + internal/model/relation.go | 1 + internal/person/mysql_repository.go | 1 + internal/person/service.go | 1 + openapi/v0.yaml | 5 +++++ web/handler/subject/related_persons.go | 1 + web/res/subject.go | 1 + 7 files changed, 11 insertions(+) diff --git a/domain/relation.go b/domain/relation.go index 6240c906f..ac9b6714c 100644 --- a/domain/relation.go +++ b/domain/relation.go @@ -29,6 +29,7 @@ type SubjectPersonRelation struct { PersonID model.PersonID SubjectID model.SubjectID + Eps string } type SubjectCharacterRelation struct { diff --git a/internal/model/relation.go b/internal/model/relation.go index 63589d551..b997cda9a 100644 --- a/internal/model/relation.go +++ b/internal/model/relation.go @@ -24,6 +24,7 @@ type SubjectPersonRelation struct { Person Person Subject Subject TypeID uint16 + Eps string } type SubjectCharacterRelation struct { diff --git a/internal/person/mysql_repository.go b/internal/person/mysql_repository.go index d14a8284e..67d62be4d 100644 --- a/internal/person/mysql_repository.go +++ b/internal/person/mysql_repository.go @@ -68,6 +68,7 @@ func (r mysqlRepo) GetSubjectRelated( rel[i] = domain.SubjectPersonRelation{ PersonID: relation.PersonID, TypeID: relation.PrsnPosition, + Eps: relation.PrsnAppearEps, } } diff --git a/internal/person/service.go b/internal/person/service.go index 7c7b5ead2..83d2948d9 100644 --- a/internal/person/service.go +++ b/internal/person/service.go @@ -65,6 +65,7 @@ func (s service) GetSubjectRelated( Person: persons[rel.PersonID], Subject: sub, TypeID: rel.TypeID, + Eps: rel.Eps, } } diff --git a/openapi/v0.yaml b/openapi/v0.yaml index e50e0959d..76cb82d6f 100644 --- a/openapi/v0.yaml +++ b/openapi/v0.yaml @@ -2961,6 +2961,7 @@ components: - type - career - relation + - eps type: object properties: id: @@ -2987,6 +2988,10 @@ components: relation: title: Relation type: string + eps: + title: Eps + type: string + description: 参与章节/曲目 UserCharacterCollection: title: UserCharacterCollection required: diff --git a/web/handler/subject/related_persons.go b/web/handler/subject/related_persons.go index af1d96196..cee74ad32 100644 --- a/web/handler/subject/related_persons.go +++ b/web/handler/subject/related_persons.go @@ -62,6 +62,7 @@ func (h Subject) GetRelatedPersons(c echo.Context) error { Career: rel.Person.Careers(), Type: rel.Person.Type, ID: rel.Person.ID, + Eps: rel.Eps, } } diff --git a/web/res/subject.go b/web/res/subject.go index 39f36e54c..ba3bde9d4 100644 --- a/web/res/subject.go +++ b/web/res/subject.go @@ -198,6 +198,7 @@ type SubjectRelatedPerson struct { Career []string `json:"career"` Type uint8 `json:"type"` ID model.PersonID `json:"id" doc:"person ID"` + Eps string `json:"eps" doc:"episodes participated"` } type Actor struct {