Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openapi/v0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3038,6 +3038,7 @@ components:
required:
- id
- name
- infobox
- type
- relation
type: object
Expand All @@ -3048,6 +3049,8 @@ components:
name:
title: Name
type: string
infobox:
"$ref": "#/components/schemas/WikiV0"
type:
type: integer
allOf:
Expand All @@ -3074,6 +3077,7 @@ components:
required:
- id
- name
- infobox
- type
- career
- relation
Expand All @@ -3086,6 +3090,8 @@ components:
name:
title: Name
type: string
infobox:
"$ref": "#/components/schemas/WikiV0"
type:
type: integer
allOf:
Expand Down
3 changes: 3 additions & 0 deletions web/handler/subject/related_characters.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net/http"
"time"

"github.com/bangumi/wiki-parser-go"
"github.com/labstack/echo/v4"
"github.com/samber/lo"
"github.com/trim21/errgo"
Expand All @@ -28,6 +29,7 @@ import (
"github.com/bangumi/server/domain/gerr"
"github.com/bangumi/server/internal/auth"
"github.com/bangumi/server/internal/model"
"github.com/bangumi/server/internal/pkg/compat"
"github.com/bangumi/server/internal/pkg/generic/slice"
"github.com/bangumi/server/internal/pkg/null"
"github.com/bangumi/server/internal/subject"
Expand Down Expand Up @@ -66,6 +68,7 @@ func (h Subject) GetRelatedCharacters(c echo.Context) error {
response[i] = res.SubjectRelatedCharacter{
Images: res.PersonImage(rel.Character.Image),
Name: rel.Character.Name,
Infobox: compat.V0Wiki(wiki.ParseOmitError(rel.Character.Infobox).NonZero()),
Relation: characterStaffString(rel.TypeID),
Actors: toActors(actors[rel.Character.ID]),
Type: rel.Character.Type,
Expand Down
3 changes: 3 additions & 0 deletions web/handler/subject/related_persons.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import (
"net/http"
"time"

"github.com/bangumi/wiki-parser-go"
"github.com/labstack/echo/v4"
"github.com/trim21/errgo"

"github.com/bangumi/server/domain/gerr"
"github.com/bangumi/server/internal/pkg/compat"
"github.com/bangumi/server/internal/pkg/null"
"github.com/bangumi/server/internal/subject"
"github.com/bangumi/server/pkg/vars"
Expand Down Expand Up @@ -59,6 +61,7 @@ func (h Subject) GetRelatedPersons(c echo.Context) error {
response[i] = res.SubjectRelatedPerson{
Images: res.PersonImage(rel.Person.Image),
Name: rel.Person.Name,
Infobox: compat.V0Wiki(wiki.ParseOmitError(rel.Person.Infobox).NonZero()),
Relation: vars.StaffMap[r.TypeID][rel.TypeID].String(),
Career: rel.Person.Careers(),
Type: rel.Person.Type,
Expand Down
2 changes: 2 additions & 0 deletions web/res/subject.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ type SubjectRelatedSubject struct {
type SubjectRelatedCharacter struct {
Images PersonImages `json:"images"`
Name string `json:"name"`
Infobox V0wiki `json:"infobox"`
Relation string `json:"relation"`
Actors []Actor `json:"actors"`
Type uint8 `json:"type"`
Expand All @@ -272,6 +273,7 @@ type SubjectRelatedCharacter struct {
type SubjectRelatedPerson struct {
Images PersonImages `json:"images"`
Name string `json:"name" doc:"person name"`
Infobox V0wiki `json:"infobox"`
Relation string `json:"relation"`
Career []string `json:"career"`
Type uint8 `json:"type"`
Expand Down