diff --git a/AniHyou/Queries/MediaCharactersAndStaff.graphql b/AniHyou/Queries/MediaCharactersAndStaff.graphql index da43d36b..036cf0e2 100644 --- a/AniHyou/Queries/MediaCharactersAndStaff.graphql +++ b/AniHyou/Queries/MediaCharactersAndStaff.graphql @@ -14,6 +14,7 @@ query MediaCharactersAndStaff($mediaId: Int) { } fragment MediaCharacter on CharacterEdge { + id role node { id @@ -36,6 +37,7 @@ fragment MediaCharacter on CharacterEdge { } fragment MediaStaff on StaffEdge { + id role node { id diff --git a/AniHyou/Screens/MediaDetails/CharacterStaff/Views/MediaCharactersAndStaffView.swift b/AniHyou/Screens/MediaDetails/CharacterStaff/Views/MediaCharactersAndStaffView.swift index 39a47e50..a4b9d623 100644 --- a/AniHyou/Screens/MediaDetails/CharacterStaff/Views/MediaCharactersAndStaffView.swift +++ b/AniHyou/Screens/MediaDetails/CharacterStaff/Views/MediaCharactersAndStaffView.swift @@ -12,7 +12,7 @@ struct MediaCharactersAndStaffView: View { let mediaId: Int @StateObject private var viewModel = CharacterStaffViewModel() private let gridRows = [ - GridItem(.fixed(StaffView.imageSize), alignment: .leading), + GridItem(.fixed(StaffView.imageSize), spacing: 16, alignment: .leading), GridItem(.fixed(StaffView.imageSize), alignment: .leading) ] @@ -47,7 +47,7 @@ struct MediaCharactersAndStaffView: View { var staffHScrollView: some View { ScrollView(.horizontal, showsIndicators: false) { LazyHGrid(rows: gridRows, spacing: 16) { - ForEach(viewModel.mediaCharactersAndStaff?.staff?.edges ?? [], id: \.?.node?.id) { + ForEach(viewModel.mediaCharactersAndStaff?.staff?.edges ?? [], id: \.?.id) { if let staff = $0 { StaffView(staff: staff.fragments.mediaStaff) } diff --git a/AniListAPI/Sources/Fragments/MediaCharacter.graphql.swift b/AniListAPI/Sources/Fragments/MediaCharacter.graphql.swift index 6a0f87bd..811efb55 100644 --- a/AniListAPI/Sources/Fragments/MediaCharacter.graphql.swift +++ b/AniListAPI/Sources/Fragments/MediaCharacter.graphql.swift @@ -5,7 +5,7 @@ public struct MediaCharacter: AniListAPI.SelectionSet, Fragment { public static var fragmentDefinition: StaticString { - #"fragment MediaCharacter on CharacterEdge { __typename role node { __typename id name { __typename userPreferred } image { __typename medium } } voiceActors(language: JAPANESE) { __typename id name { __typename userPreferred } image { __typename medium } } }"# + #"fragment MediaCharacter on CharacterEdge { __typename id role node { __typename id name { __typename userPreferred } image { __typename medium } } voiceActors(language: JAPANESE) { __typename id name { __typename userPreferred } image { __typename medium } } }"# } public let __data: DataDict @@ -14,11 +14,14 @@ public struct MediaCharacter: AniListAPI.SelectionSet, Fragment { public static var __parentType: ApolloAPI.ParentType { AniListAPI.Objects.CharacterEdge } public static var __selections: [ApolloAPI.Selection] { [ .field("__typename", String.self), + .field("id", Int?.self), .field("role", GraphQLEnum?.self), .field("node", Node?.self), .field("voiceActors", [VoiceActor?]?.self, arguments: ["language": "JAPANESE"]), ] } + /// The id of the connection + public var id: Int? { __data["id"] } /// The characters role in the media public var role: GraphQLEnum? { __data["role"] } public var node: Node? { __data["node"] } diff --git a/AniListAPI/Sources/Fragments/MediaStaff.graphql.swift b/AniListAPI/Sources/Fragments/MediaStaff.graphql.swift index 99edbfca..8d9bb75f 100644 --- a/AniListAPI/Sources/Fragments/MediaStaff.graphql.swift +++ b/AniListAPI/Sources/Fragments/MediaStaff.graphql.swift @@ -5,7 +5,7 @@ public struct MediaStaff: AniListAPI.SelectionSet, Fragment { public static var fragmentDefinition: StaticString { - #"fragment MediaStaff on StaffEdge { __typename role node { __typename id name { __typename userPreferred } image { __typename medium } } }"# + #"fragment MediaStaff on StaffEdge { __typename id role node { __typename id name { __typename userPreferred } image { __typename medium } } }"# } public let __data: DataDict @@ -14,10 +14,13 @@ public struct MediaStaff: AniListAPI.SelectionSet, Fragment { public static var __parentType: ApolloAPI.ParentType { AniListAPI.Objects.StaffEdge } public static var __selections: [ApolloAPI.Selection] { [ .field("__typename", String.self), + .field("id", Int?.self), .field("role", String?.self), .field("node", Node?.self), ] } + /// The id of the connection + public var id: Int? { __data["id"] } /// The role of the staff member in the production of the media public var role: String? { __data["role"] } public var node: Node? { __data["node"] } diff --git a/AniListAPI/Sources/Operations/Queries/MediaCharactersAndStaffQuery.graphql.swift b/AniListAPI/Sources/Operations/Queries/MediaCharactersAndStaffQuery.graphql.swift index 3b77e70c..2670bf17 100644 --- a/AniListAPI/Sources/Operations/Queries/MediaCharactersAndStaffQuery.graphql.swift +++ b/AniListAPI/Sources/Operations/Queries/MediaCharactersAndStaffQuery.graphql.swift @@ -86,6 +86,8 @@ public class MediaCharactersAndStaffQuery: GraphQLQuery { .fragment(MediaCharacter.self), ] } + /// The id of the connection + public var id: Int? { __data["id"] } /// The characters role in the media public var role: GraphQLEnum? { __data["role"] } public var node: Node? { __data["node"] } @@ -133,6 +135,8 @@ public class MediaCharactersAndStaffQuery: GraphQLQuery { .fragment(MediaStaff.self), ] } + /// The id of the connection + public var id: Int? { __data["id"] } /// The role of the staff member in the production of the media public var role: String? { __data["role"] } public var node: Node? { __data["node"] }