Skip to content

Commit

Permalink
feat: include field PrsnAppearEps in subject persons response (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
Contextualist authored Aug 16, 2024
1 parent a8d4297 commit 8707b09
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions domain/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type SubjectPersonRelation struct {

PersonID model.PersonID
SubjectID model.SubjectID
Eps string
}

type SubjectCharacterRelation struct {
Expand Down
1 change: 1 addition & 0 deletions internal/model/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type SubjectPersonRelation struct {
Person Person
Subject Subject
TypeID uint16
Eps string
}

type SubjectCharacterRelation struct {
Expand Down
1 change: 1 addition & 0 deletions internal/person/mysql_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (r mysqlRepo) GetSubjectRelated(
rel[i] = domain.SubjectPersonRelation{
PersonID: relation.PersonID,
TypeID: relation.PrsnPosition,
Eps: relation.PrsnAppearEps,
}
}

Expand Down
1 change: 1 addition & 0 deletions internal/person/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func (s service) GetSubjectRelated(
Person: persons[rel.PersonID],
Subject: sub,
TypeID: rel.TypeID,
Eps: rel.Eps,
}
}

Expand Down
5 changes: 5 additions & 0 deletions openapi/v0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,7 @@ components:
- type
- career
- relation
- eps
type: object
properties:
id:
Expand All @@ -2987,6 +2988,10 @@ components:
relation:
title: Relation
type: string
eps:
title: Eps
type: string
description: 参与章节/曲目
UserCharacterCollection:
title: UserCharacterCollection
required:
Expand Down
1 change: 1 addition & 0 deletions web/handler/subject/related_persons.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
1 change: 1 addition & 0 deletions web/res/subject.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8707b09

Please sign in to comment.