diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d41fdb0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +# environment file +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b01fef5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# FROM golang:alpine3.19 as go_builder + +# FROM go_builder as backend +# RUN ["git", "clone", "https://github.com/ling734/hoppscotch-backend-go.git", "/app"] +# WORKDIR /app +# RUN ["go", "mod", "download"] +# RUN ["go", "build", "-o", "./bin/server", "./server.go"] + +FROM nginx:latest +# FROM caddy:latest +WORKDIR /app +COPY template ./template/ +COPY nginx.conf /etc/nginx/ +# COPY aio.Caddyfile /etc/caddy/Caddyfile +COPY --chmod=755 import-meta-env . +COPY --chmod=755 server . +COPY --chmod=755 healthcheck.sh . + +COPY --from=hoppscotch/hoppscotch:latest /site /site +# COPY --from=backend /app/bin/hoppscotch ./hoppscotch + +RUN sed -i "s@/archive.ubuntu.com/@/mirrors.tuna.tsinghua.edu.cn/@g" /etc/apt/sources.list.d/debian.sources && apt-get update +RUN apt install -y tini curl +# RUN apt install -y nodejs npm +# RUN npm install -g @import-meta-env/cli + +HEALTHCHECK --interval=2s CMD /bin/sh /app/healthcheck.sh +ENTRYPOINT [ "tini", "--" ] +# CMD printenv > build.env && npx import-meta-env -x build.env -e build.env -p "/site/**/*" && nginx && /app/server +CMD /app/import-meta-env /site & nginx & /app/server +# CMD /app/import-meta-env /site & /app/server & caddy run --config /etc/caddy/Caddyfile --adapter caddyfile +EXPOSE 3000/tcp +EXPOSE 3100/tcp +EXPOSE 3170/tcp \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..91d6ce4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Flynn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7125173 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# hoppscotch-backend-go \ No newline at end of file diff --git a/api/graphql/schema.graphqls b/api/graphql/schema.graphqls new file mode 100644 index 0000000..1092a1d --- /dev/null +++ b/api/graphql/schema.graphqls @@ -0,0 +1,1756 @@ +directive @isLogin on FIELD_DEFINITION +directive @isAdmin on FIELD_DEFINITION + +type User { + """UID of the user""" + uid: ID! + + """Name of the user (if fetched)""" + displayName: String + + """Email of the user""" + email: String + + """URL to the profile photo of the user (if fetched)""" + photoURL: String + + """Flag to determine if user is an Admin or not""" + isAdmin: Boolean! + + """Date when the user account was created""" + createdOn: DateTime! + + """Stringified current REST session for logged-in User""" + currentRESTSession: String + + """Stringified current GraphQL session for logged-in User""" + currentGQLSession: String + + """Returns user settings""" + settings: UserSettings! + + """Returns a list of users personal environments""" + environments: [UserEnvironment!]! + + """Returns the users global environments""" + globalEnvironments: UserEnvironment! + + """Returns a users REST history""" + RESTHistory( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserHistory!]! + + """Returns a users GraphQL history""" + GQLHistory( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserHistory!]! +} + +""" +A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format. +""" +scalar DateTime + +type UserSettings { + """ID of the User Setting""" + id: ID! + + """ID of the user this setting belongs to""" + userUid: ID! + + """Stringified JSON settings object""" + properties: String! + + """Last updated on""" + updatedOn: DateTime! +} + +type UserEnvironment { + """ID of the User Environment""" + id: ID! + + """ID of the user this environment belongs to""" + userUid: ID! + + """Name of the environment""" + name: String + + """All variables present in the environment""" + variables: String! + + """Flag to indicate the environment is global or not""" + isGlobal: Boolean! +} + +type UserCollection { + """ID of the user collection""" + id: ID! + + """Displayed title of the user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + + """Type of the user collection""" + type: ReqType! + + """Returns user requests of a user collection""" + requests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserRequest!]! + + """User the collection belongs to""" + user: User! + + """Parent user collection (null if root)""" + parent: UserCollection + + """List of children REST user collection""" + childrenREST( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """List of children GraphQL user collection""" + childrenGQL( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! +} + +enum ReqType { + REST + GQL +} + +type UserCollectionReorderData { + """User Collection being moved""" + userCollection: UserCollection! + + """ + User Collection succeeding the collection being moved in its new position + """ + nextUserCollection: UserCollection +} + +type UserCollectionRemovedData { + """ID of User Collection being removed""" + id: ID! + + """Type of the user collection""" + type: ReqType! +} + +type UserCollectionExportJSONData { + """Stringified contents of the collection""" + exportedCollection: ID! + + """Type of the user collection""" + collectionType: ReqType! +} + +type UserRequest { + """ID of the user request""" + id: ID! + + """ID of the parent collection ID""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """Content/Body of the user request""" + request: String! + + """Type (GRAPHQL/REST) of the user request""" + type: ReqType! + + """Date of the user request creation""" + createdOn: DateTime! + + """Returns the user of the user request""" + user: User! +} + +type UserRequestReorderData { + """User request being moved""" + request: UserRequest! + + """User request succeeding the request being moved in its new position""" + nextRequest: UserRequest +} + +type UserHistory { + """ID of the user request in history""" + id: ID! + + """ID of the user this history belongs to""" + userUid: ID! + + """Type of the request in the history""" + reqType: ReqType! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the response meta-data""" + responseMetadata: String! + + """If the request in the history starred""" + isStarred: Boolean! + + """Timestamp of when the request was executed or history was created""" + executedOn: DateTime! +} + +type UserHistoryDeletedManyData { + """Number of user histories deleted""" + count: Int! + + """Type of the request in the history""" + reqType: ReqType! +} + +type Team { + """ID of the team""" + id: ID! + + """Displayed name of the team""" + name: String! + + """Returns the list of members of a team""" + members( + """The ID of the last returned team member entry (used for pagination)""" + cursor: ID + ): [TeamMember!]! + + """Returns the list of members of a team""" + teamMembers: [TeamMember!]! + + """The role of the current user in the team""" + myRole: TeamMemberRole + + """The number of users with the OWNER role in the team""" + ownersCount: Int! + + """The number of users with the EDITOR role in the team""" + editorsCount: Int! + + """The number of users with the VIEWER role in the team""" + viewersCount: Int! + + """Get all the active invites in the team""" + teamInvitations: [TeamInvitation!]! + + """Returns all Team Environments for the given Team""" + teamEnvironments: [TeamEnvironment!]! +} + +enum TeamMemberRole { + OWNER + VIEWER + EDITOR +} + +type TeamMember { + """Membership ID of the Team Member""" + membershipID: ID! + + """Role of the given team member in the given team""" + role: TeamMemberRole! + user: User! +} + +type TeamEnvironment { + """ID of the Team Environment""" + id: ID! + + """ID of the team this environment belongs to""" + teamID: ID! + + """Name of the environment""" + name: String! + + """All variables present in the environment""" + variables: String! +} + +type TeamCollection { + """ID of the collection""" + id: ID! + + """Displayed title of the collection""" + title: String! + + """JSON string representing the collection data""" + data: String + + """ID of the collection""" + parentID: ID + + """Team the collection belongs to""" + team: Team! + + """Return the parent Team Collection (null if root )""" + parent: TeamCollection + + """List of children Team Collections""" + children( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [TeamCollection!]! +} + +type CollectionReorderData { + """Team Collection being moved""" + collection: TeamCollection! + + """ + Team Collection succeeding the collection being moved in its new position + """ + nextCollection: TeamCollection +} + +type TeamRequest { + """ID of the request""" + id: ID! + + """ID of the collection the request belongs to.""" + collectionID: ID! + + """ID of the team the request belongs to.""" + teamID: ID! + + """JSON string representing the request data""" + request: String! + + """Displayed title of the request""" + title: String! + + """Team the request belongs to""" + team: Team! + + """Collection the request belongs to""" + collection: TeamCollection! +} + +type RequestReorderData { + """Team Request being moved""" + request: TeamRequest! + + """Team Request succeeding the request being moved in its new position""" + nextRequest: TeamRequest +} + +type TeamInvitation { + """ID of the invite""" + id: ID! + + """ID of the team the invite is to""" + teamID: ID! + + """UID of the creator of the invite""" + creatorUid: ID! + + """Email of the invitee""" + inviteeEmail: String! + + """The role that will be given to the invitee""" + inviteeRole: TeamMemberRole! + + """Get the team associated to the invite""" + team: Team! + + """Get the creator of the invite""" + creator: User! +} + +type Admin { + """UID of the user""" + uid: ID! + + """Name of the user (if fetched)""" + displayName: String + + """Email of the user""" + email: String + + """URL to the profile photo of the user (if fetched)""" + photoURL: String + + """Date when the user account was created""" + createdOn: DateTime! + + """Returns a list of all admin users in infra""" + admins: [User!]! @deprecated(reason: "Use `infra` query instead") + + """Returns a user info by UID""" + userInfo( + """The user UID""" + userUid: ID! + ): User! @deprecated(reason: "Use `infra` query instead") + + """Returns a list of all the users in infra""" + allUsers( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [User!]! @deprecated(reason: "Use `infra` query instead") + + """Returns a list of all the invited users""" + invitedUsers: [InvitedUser!]! @deprecated(reason: "Use `infra` query instead") + + """Returns a list of all the teams in the infra""" + allTeams( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Team!]! @deprecated(reason: "Use `infra` query instead") + + """Returns a team info by ID when requested by Admin""" + teamInfo( + """Team ID for which info to fetch""" + teamID: ID! + ): Team! @deprecated(reason: "Use `infra` query instead") + + """Return count of all the members in a team""" + membersCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use `infra` query instead") + + """Return count of all the stored collections in a team""" + collectionCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use `infra` query instead") + + """Return count of all the stored requests in a team""" + requestCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use `infra` query instead") + + """Return count of all the stored environments in a team""" + environmentCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use `infra` query instead") + + """Return all the pending invitations in a team""" + pendingInvitationCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): [TeamInvitation!]! @deprecated(reason: "Use `infra` query instead") + + """Return total number of Users in organization""" + usersCount: Int! @deprecated(reason: "Use `infra` query instead") + + """Return total number of Teams in organization""" + teamsCount: Int! @deprecated(reason: "Use `infra` query instead") + + """Return total number of Team Collections in organization""" + teamCollectionsCount: Int! @deprecated(reason: "Use `infra` query instead") + + """Return total number of Team Requests in organization""" + teamRequestsCount: Int! @deprecated(reason: "Use `infra` query instead") +} + +type InvitedUser { + """Admin UID""" + adminUid: ID! + + """Admin email""" + adminEmail: String! + + """Invitee email""" + inviteeEmail: String! + + """Date when the user invitation was sent""" + invitedOn: DateTime! +} + +type Infra { + """Admin who executed the action""" + executedBy: Admin! + + """Returns a list of all admin users in infra""" + admins: [User!]! + + """Returns a user info by UID""" + userInfo( + """The user UID""" + userUid: ID! + ): User! + + """Returns a list of all the users in infra""" + allUsers( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [User!]! + + """Returns a list of all the invited users""" + invitedUsers: [InvitedUser!]! + + """Returns a list of all the teams in the infra""" + allTeams( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Team!]! + + """Returns a team info by ID when requested by Admin""" + teamInfo( + """Team ID for which info to fetch""" + teamID: ID! + ): Team! + + """Return count of all the members in a team""" + membersCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored collections in a team""" + collectionCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored requests in a team""" + requestCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored environments in a team""" + environmentCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return all the pending invitations in a team""" + pendingInvitationCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): [TeamInvitation!]! + + """Return total number of Users in organization""" + usersCount: Int! + + """Return total number of Teams in organization""" + teamsCount: Int! + + """Return total number of Team Collections in organization""" + teamCollectionsCount: Int! + + """Return total number of Team Requests in organization""" + teamRequestsCount: Int! + + """Returns a list of all the shortcodes in the infra""" + allShortcodes( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Users email to filter shortcodes by""" + userEmail: String + ): [ShortcodeWithUserEmail!]! +} + +type Shortcode { + """The 12 digit alphanumeric code""" + id: ID! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the properties for an embed""" + properties: String + + """Timestamp of when the Shortcode was created""" + createdOn: DateTime! +} + +type ShortcodeCreator { + """Uid of user who created the shortcode""" + uid: String! + + """Email of user who created the shortcode""" + email: String! +} + +type ShortcodeWithUserEmail { + """The 12 digit alphanumeric code""" + id: ID! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the properties for an embed""" + properties: String + + """Timestamp of when the Shortcode was created""" + createdOn: DateTime! + + """Details of user who created the shortcode""" + creator: ShortcodeCreator +} + +type InfraConfig { + """Infra Config Name""" + name: String! + + """Infra Config Value""" + value: String! +} + +type Query { + """ + Gives details of the user executing this query (pass Authorization 'Bearer' header) + """ + me: User! @isLogin + + """Fetch details of the Infrastructure""" + infra: Infra! + + """Retrieve configuration details for the instance""" + infraConfigs( + """Configs to fetch""" + configNames: [InfraConfigEnum!]! + ): [InfraConfig!]! + + """Allowed Auth Provider list""" + allowedAuthProviders: [String!]! + + """Gives details of the admin executing this query""" + admin: Admin! + + """List of teams that the executing user belongs to.""" + myTeams( + """The ID of the last returned team entry (used for pagination)""" + cursor: ID + ): [Team!]! + + """Returns the detail of the team with the given ID""" + team( + """ID of the team to check""" + teamID: ID! + ): Team + + """Gets the Team Invitation with the given ID, or null if not exists""" + teamInvitation( + """ID of the Team Invitation to lookup""" + inviteID: ID! + ): TeamInvitation! + + """ + Returns the JSON string giving the collections and their contents of the team + """ + exportCollectionsToJSON( + """ID of the team""" + teamID: ID! + ): String! + + """Returns the collections of a team""" + rootCollectionsOfTeam( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the team""" + teamID: ID! + ): [TeamCollection!]! + + """Get a Team Collection with ID or null (if not exists)""" + collection( + """ID of the collection""" + collectionID: ID! + ): TeamCollection + + """Search the team for a specific request with title""" + searchForRequest( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the team to look in""" + teamID: ID! + + """The title to search for""" + searchTerm: String! + ): [TeamRequest!]! + + """Gives a request with the given ID or null (if not exists)""" + request( + """ID of the request""" + requestID: ID! + ): TeamRequest + + """Gives a paginated list of requests in the collection""" + requestsInCollection( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the collection to look in""" + collectionID: ID! + ): [TeamRequest!]! + + """Resolves and returns a shortcode data""" + shortcode( + """The shortcode to resolve""" + code: ID! + ): Shortcode + + """List all shortcodes the current user has generated""" + myShortcodes( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Shortcode!]! + + """Get REST user requests""" + userRESTRequests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Collection ID of the user request""" + collectionID: ID + ): [UserRequest!]! + + """Get GraphQL user requests""" + userGQLRequests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Collection ID of the user request""" + collectionID: ID + ): [UserRequest!]! + + """Get a user request by ID""" + userRequest( + """ID of the user request""" + id: ID! + ): UserRequest! + + """Get the root REST user collections for a user""" + rootRESTUserCollections( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """Get the root GraphQL user collections for a user""" + rootGQLUserCollections( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """Get user collection with ID""" + userCollection( + """ID of the user collection""" + userCollectionID: ID! + ): UserCollection! + + """ + Returns the JSON string giving the collections and their contents of a user + """ + exportUserCollectionsToJSON( + """ID of the user collection""" + collectionID: ID = null + + """Type of the user collection""" + collectionType: ReqType! + ): UserCollectionExportJSONData! +} + +enum InfraConfigEnum { + MAILER_SMTP_URL + MAILER_ADDRESS_FROM + GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET + GITHUB_CLIENT_ID + GITHUB_CLIENT_SECRET + MICROSOFT_CLIENT_ID + MICROSOFT_CLIENT_SECRET +} + +type Mutation { + """Update user sessions""" + updateUserSessions( + """JSON string of the saved REST/GQL session""" + currentSession: String! + + """Type of the session""" + sessionType: SessionType! + ): User! + + """Delete an user account""" + deleteUser: Boolean! + + """Update Infra Configs""" + updateInfraConfigs( + """InfraConfigs to update""" + infraConfigs: [InfraConfigArgs!]! + ): [InfraConfig!]! + + """Reset Infra Configs with default values (.env)""" + resetInfraConfigs: Boolean! + + """Enable or Disable SSO for login/signup""" + enableAndDisableSSO( + """SSO provider and status""" + providerInfo: [EnableAndDisableSSOArgs!]! + ): Boolean! + + """Invite a user to the infra using email""" + inviteNewUser( + """invitee email""" + inviteeEmail: String! + ): InvitedUser! + + """Delete an user account from infra""" + removeUserByAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Make user an admin""" + makeUserAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Remove user as admin""" + removeUserAsAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Create a new team by providing the user uid to nominate as Team owner""" + createTeamByAdmin( + """users uid to make team owner""" + userUid: ID! + + """Displayed name of the team""" + name: String! + ): Team! + + """Change the role of a user in a team""" + changeUserRoleInTeamByAdmin( + """users UID""" + userUID: ID! + + """team ID""" + teamID: ID! + + """updated team role""" + newRole: TeamMemberRole! + ): TeamMember! + + """Remove the user from a team""" + removeUserFromTeamByAdmin( + """users UID""" + userUid: ID! + + """team ID""" + teamID: ID! + ): Boolean! + + """Add a user to a team with email and team member role""" + addUserToTeamByAdmin( + """team ID""" + teamID: ID! + + """The role of the user to add in the team""" + role: TeamMemberRole! + + """Email of the user to add to team""" + userEmail: String! + ): TeamMember! + + """Change a team name""" + renameTeamByAdmin( + """ID of the team""" + teamID: ID! + + """The updated name of the team""" + newName: String! + ): Team! + + """Delete a team""" + deleteTeamByAdmin( + """ID of the team""" + teamID: ID! + ): Boolean! + + """Revoke a team Invite by Invite ID""" + revokeTeamInviteByAdmin( + """Team Invite ID""" + inviteID: ID! + ): Boolean! + + """Revoke Shortcode by ID""" + revokeShortcodeByAdmin( + """The shortcode to delete""" + code: ID! + ): Boolean! + + """Creates a team owned by the executing user""" + createTeam( + """Displayed name of the team""" + name: String! + ): Team! + + """Leaves a team the executing user is a part of""" + leaveTeam( + """ID of the Team to leave""" + teamID: ID! + ): Boolean! + + """Removes the team member from the team""" + removeTeamMember( + """ID of the Team to remove user from""" + teamID: ID! + + """ID of the user to remove from the given team""" + userUid: ID! + ): Boolean! + + """Renames a team""" + renameTeam( + """ID of the team""" + teamID: ID! + + """The updated name of the team""" + newName: String! + ): Team! + + """Deletes the team""" + deleteTeam( + """ID of the team""" + teamID: ID! + ): Boolean! + + """Update role of a team member the executing user owns""" + updateTeamMemberRole( + """ID of the affected team""" + teamID: ID! + + """UID of the affected user""" + userUid: ID! + + """Updated role value""" + newRole: TeamMemberRole! + ): TeamMember! + + """Creates a Team Invitation""" + createTeamInvitation( + """ID of the Team ID to invite from""" + teamID: ID! + + """Email of the user to invite""" + inviteeEmail: String! + + """Role to be given to the user""" + inviteeRole: TeamMemberRole! + ): TeamInvitation! + + """Revokes an invitation and deletes it""" + revokeTeamInvitation( + """ID of the invite to revoke""" + inviteID: ID! + ): Boolean! + + """Accept an Invitation""" + acceptTeamInvitation( + """ID of the Invite to accept""" + inviteID: ID! + ): TeamMember! + + """Create a new Team Environment for given Team ID""" + createTeamEnvironment( + """Name of the Team Environment""" + name: String! + + """ID of the Team""" + teamID: ID! + + """JSON string of the variables object""" + variables: String! + ): TeamEnvironment! + + """Delete a Team Environment for given Team ID""" + deleteTeamEnvironment( + """ID of the Team Environment""" + id: ID! + ): Boolean! + + """ + Add/Edit a single environment variable or variables to a Team Environment + """ + updateTeamEnvironment( + """ID of the Team Environment""" + id: ID! + + """Name of the Team Environment""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): TeamEnvironment! + + """Delete all variables from a Team Environment""" + deleteAllVariablesFromTeamEnvironment( + """ID of the Team Environment""" + id: ID! + ): TeamEnvironment! + + """Create a duplicate of an existing environment""" + createDuplicateEnvironment( + """ID of the Team Environment""" + id: ID! + ): TeamEnvironment! + + """ + Creates a collection at the root of the team hierarchy (no parent collection) + """ + createRootCollection( + """ID of the team""" + teamID: ID! + + """Title of the new collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Import collections from JSON string to the specified Team""" + importCollectionsFromJSON( + """Id of the team to add to""" + teamID: ID! + + """JSON string to import""" + jsonString: String! + + """ + ID to the collection to which to import to (null if to import to the root of team) + """ + parentCollectionID: ID + ): Boolean! + + """ + Replace existing collections of a specific team with collections in JSON string + """ + replaceCollectionsWithJSON( + """Id of the team to add to""" + teamID: ID! + + """JSON string to replace with""" + jsonString: String! + + """ + ID to the collection to which to import to (null if to import to the root of team) + """ + parentCollectionID: ID + ): Boolean! + + """Create a collection that has a parent collection""" + createChildCollection( + """ID of the parent to the new collection""" + collectionID: ID! + + """Title of the new collection""" + childTitle: String! + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Rename a collection""" + renameCollection( + """ID of the collection""" + collectionID: ID! + + """The updated title of the collection""" + newTitle: String! + ): TeamCollection! @deprecated(reason: "Switch to updateTeamCollection mutation instead") + + """Delete a collection""" + deleteCollection( + """ID of the collection""" + collectionID: ID! + ): Boolean! + + """Move a collection into a new parent collection or the root of the team""" + moveCollection( + """ID of the parent to the new collection""" + parentCollectionID: ID + + """ID of the collection""" + collectionID: ID! + ): TeamCollection! + + """Update the order of collections""" + updateCollectionOrder( + """ID of the collection""" + collectionID: ID! + + """ + ID of the collection that comes after the updated collection in its new position + """ + destCollID: ID + ): Boolean! + + """Update Team Collection details""" + updateTeamCollection( + """ID of the collection""" + collectionID: ID! + + """The updated title of the collection""" + newTitle: String + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Create a team request in the given collection.""" + createRequestInCollection( + """ID of the collection""" + collectionID: ID! + + """The request data (stringified JSON of Hoppscotch request object)""" + data: CreateTeamRequestInput! + ): TeamRequest! + + """Update a request with the given ID""" + updateRequest( + """ID of the request""" + requestID: ID! + + """ + The updated request data (stringified JSON of Hoppscotch request object) + """ + data: UpdateTeamRequestInput! + ): TeamRequest! + + """Delete a request with the given ID""" + deleteRequest( + """ID of the request""" + requestID: ID! + ): Boolean! + + """Update the order of requests in the lookup table""" + updateLookUpRequestOrder( + """ID of the collection""" + collectionID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + + """ID of the request to move""" + requestID: ID! + ): Boolean! + + """Move a request to the given collection""" + moveRequest( + """ID of the collection, the request belong to""" + srcCollID: ID + + """ID of the request to move""" + requestID: ID! + + """ID of the collection, where the request is moving to""" + destCollID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + ): TeamRequest! + + """Create a shortcode for the given request.""" + createShortcode( + """JSON string of the request object""" + request: String! + + """JSON string of the properties of the embed""" + properties: String + ): Shortcode! + + """Update a user generated Shortcode""" + updateEmbedProperties( + """The Shortcode to update""" + code: ID! + + """JSON string of the properties of the embed""" + properties: String! + ): Shortcode! + + """Revoke a user generated shortcode""" + revokeShortcode( + """The shortcode to remove""" + code: ID! + ): Boolean! + + """Creates a new user setting""" + createUserSettings( + """Stringified JSON settings object""" + properties: String! + ): UserSettings! + + """Update user setting for a given user""" + updateUserSettings( + """Stringified JSON settings object""" + properties: String! + ): UserSettings! + + """Create a new personal user environment for given user uid""" + createUserEnvironment( + """Name of the User Environment, if global send an empty string""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Create a new global user environment for given user uid""" + createUserGlobalEnvironment( + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Updates a users personal or global environment""" + updateUserEnvironment( + """ID of the user environment""" + id: ID! + + """Name of the User Environment, if global send an empty string""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Deletes a users personal environment""" + deleteUserEnvironment( + """ID of the user environment""" + id: ID! + ): Boolean! + + """Deletes all of users personal environments""" + deleteUserEnvironments: Int! + + """Deletes all variables inside a users global environment""" + clearGlobalEnvironments( + """ID of the users global environment""" + id: ID! + ): UserEnvironment! + + """Adds a new REST/GQL request to user history""" + createUserHistory( + """JSON string of the request data""" + reqData: String! + + """JSON string of the response metadata""" + resMetadata: String! + + """Request type, REST or GQL""" + reqType: ReqType! + ): UserHistory! + + """Stars/Unstars a REST/GQL request in user history""" + toggleHistoryStarStatus( + """ID of User History""" + id: ID! + ): UserHistory! + + """Removes a REST/GQL request from user history""" + removeRequestFromHistory( + """ID of User History""" + id: ID! + ): UserHistory! + + """Deletes all REST/GQL history for a user based on Request type""" + deleteAllUserHistory( + """Request type, REST or GQL""" + reqType: ReqType! + ): UserHistoryDeletedManyData! + + """Create a new user REST request""" + createRESTUserRequest( + """Collection ID of the user request""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """content/body of the user request""" + request: String! + ): UserRequest! + + """Create a new user GraphQL request""" + createGQLUserRequest( + """Collection ID of the user request""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """content/body of the user request""" + request: String! + ): UserRequest! + + """Update a user REST request""" + updateRESTUserRequest( + """ID of the user REST request""" + id: ID! + + """Title of the user request""" + title: String + + """content/body of the user request""" + request: String + ): UserRequest! + + """Update a user GraphQL request""" + updateGQLUserRequest( + """ID of the user GraphQL request""" + id: ID! + + """Title of the user request""" + title: String + + """content/body of the user request""" + request: String + ): UserRequest! + + """Delete a user request""" + deleteUserRequest( + """ID of the user request""" + id: ID! + ): Boolean! + + """Move and re-order of a user request within same or across collection""" + moveUserRequest( + """ID of the collection, where the request is belongs to""" + sourceCollectionID: ID! + + """ID of the request being moved""" + requestID: ID! + + """ID of the collection, where the request is moving to""" + destinationCollectionID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + ): UserRequest! + + """Creates root REST user collection(no parent user collection)""" + createRESTRootUserCollection( + """Title of the new user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates root GraphQL user collection(no parent user collection)""" + createGQLRootUserCollection( + """Title of the new user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates a new child GraphQL user collection""" + createGQLChildUserCollection( + """Title of the new user collection""" + title: String! + + """ID of the parent to the new user collection""" + parentUserCollectionID: ID! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates a new child REST user collection""" + createRESTChildUserCollection( + """Title of the new user collection""" + title: String! + + """ID of the parent to the new user collection""" + parentUserCollectionID: ID! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Rename a user collection""" + renameUserCollection( + """ID of the user collection""" + userCollectionID: ID! + + """The updated title of the user collection""" + newTitle: String! + ): UserCollection! + + """Delete a user collection""" + deleteUserCollection( + """ID of the user collection""" + userCollectionID: ID! + ): Boolean! + + """Move user collection into new parent or root""" + moveUserCollection( + """ID of the parent to the new collection""" + destCollectionID: ID + + """ID of the collection""" + userCollectionID: ID! + ): UserCollection! + + """ + Update the order of UserCollections inside parent collection or in root + """ + updateUserCollectionOrder( + """ID of collection being moved""" + collectionID: ID! + + """ID of collection being moved""" + nextCollectionID: ID + ): Boolean! + + """Import collections from JSON string to the specified Team""" + importUserCollectionsFromJSON( + """JSON string to import""" + jsonString: String! + + """Type of UserCollection""" + reqType: ReqType! + + """ + ID to the collection to which to import into (null if to import into the root of the user) + """ + parentCollectionID: ID + ): Boolean! + + """Update a UserCollection""" + updateUserCollection( + """ID of the user collection""" + userCollectionID: ID! + + """The updated title of the user collection""" + newTitle: String + + """JSON string representing the collection data""" + data: String + ): UserCollection! +} + +enum SessionType { + REST + GQL +} + +input InfraConfigArgs { + """Infra Config Name""" + name: InfraConfigEnum! + + """Infra Config Value""" + value: String! +} + +input EnableAndDisableSSOArgs { + """Auth Provider""" + provider: AuthProvider! + + """Auth Provider Status""" + status: ServiceStatus! +} + +enum AuthProvider { + GOOGLE + GITHUB + MICROSOFT + EMAIL +} + +enum ServiceStatus { + ENABLE + DISABLE +} + +input CreateTeamRequestInput { + """ID of the team the collection belongs to""" + teamID: ID! + + """JSON string representing the request data""" + request: String! + + """Displayed title of the request""" + title: String! +} + +input UpdateTeamRequestInput { + """JSON string representing the request data""" + request: String + + """Displayed title of the request""" + title: String +} + +type Subscription { + """Listen for user updates""" + userUpdated: User! + + """Listen for user deletion""" + userDeleted: User! + + """Listen for User Invitation""" + userInvited: InvitedUser! + + """ + Listen to when a new team member being added to the team. The emitted value is the new team member added. + """ + teamMemberAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamMember! + + """ + Listen to when a team member status has been updated. The emitted value is the new team member status + """ + teamMemberUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamMember! + + """ + Listen to when a team member has been removed. The emitted value is the uid of the user removed + """ + teamMemberRemoved( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Listens to when a Team Invitation is added""" + teamInvitationAdded( + """ID of the Team to listen to""" + teamID: ID! + ): TeamInvitation! + + """Listens to when a Team Invitation is removed""" + teamInvitationRemoved( + """ID of the Team to listen to""" + teamID: ID! + ): ID! + + """Listen for Team Environment Updates""" + teamEnvironmentUpdated( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """Listen for Team Environment Creation Messages""" + teamEnvironmentCreated( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """Listen for Team Environment Deletion Messages""" + teamEnvironmentDeleted( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """ + Listen to when a collection has been added to a team. The emitted value is the team added + """ + teamCollectionAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collection has been updated.""" + teamCollectionUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collection has been removed""" + teamCollectionRemoved( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Listen to when a collection has been moved""" + teamCollectionMoved( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collections position has changed""" + collectionOrderUpdated( + """ID of the team to listen to""" + teamID: ID! + ): CollectionReorderData! + + """Emits when a new request is added to a team""" + teamRequestAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """Emitted when a request has been updated""" + teamRequestUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """ + Emitted when a request has been deleted. Only the id of the request is emitted. + """ + teamRequestDeleted( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Emitted when a requests position has been changed in its collection""" + requestOrderUpdated( + """ID of the team to listen to""" + teamID: ID! + ): RequestReorderData! + + """Emitted when a request has been moved from one collection into another""" + requestMoved( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """Listen for shortcode creation""" + myShortcodesCreated: Shortcode! + + """Listen for Shortcode updates""" + myShortcodesUpdated: Shortcode! + + """Listen for shortcode deletion""" + myShortcodesRevoked: Shortcode! + + """Listen for user setting creation""" + userSettingsCreated: UserSettings! + + """Listen for user setting updates""" + userSettingsUpdated: UserSettings! + + """Listen for User Environment Creation""" + userEnvironmentCreated: UserEnvironment! + + """Listen for User Environment updates""" + userEnvironmentUpdated: UserEnvironment! + + """Listen for User Environment deletion""" + userEnvironmentDeleted: UserEnvironment! + + """Listen for User Environment DeleteMany""" + userEnvironmentDeleteMany: Int! + + """Listen for User History Creation""" + userHistoryCreated: UserHistory! + + """Listen for User History update""" + userHistoryUpdated: UserHistory! + + """Listen for User History deletion""" + userHistoryDeleted: UserHistory! + + """Listen for User History deleted many""" + userHistoryDeletedMany: UserHistoryDeletedManyData! + + """Listen for User Request Creation""" + userRequestCreated: UserRequest! + + """Listen for User Request Update""" + userRequestUpdated: UserRequest! + + """Listen for User Request Deletion""" + userRequestDeleted: UserRequest! + + """Listen for User Request Moved""" + userRequestMoved: UserRequestReorderData! + + """Listen for User Collection Creation""" + userCollectionCreated: UserCollection! + + """Listen to when a User Collection has been updated.""" + userCollectionUpdated: UserCollection! + + """Listen to when a User Collection has been deleted""" + userCollectionRemoved: UserCollectionRemovedData! + + """Listen to when a User Collection has been moved""" + userCollectionMoved: UserCollection! + + """Listen to when a User Collections position has changed""" + userCollectionOrderUpdated: UserCollectionReorderData! +} diff --git a/cmd/dumpper/go.mod b/cmd/dumpper/go.mod new file mode 100644 index 0000000..e428afd --- /dev/null +++ b/cmd/dumpper/go.mod @@ -0,0 +1,27 @@ +module dumpper + +go 1.21.5 + +require ( + gorm.io/driver/postgres v1.5.4 + gorm.io/gen v0.3.24 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.4.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.6.0 // indirect + gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect + gorm.io/driver/mysql v1.5.1-0.20230509030346-3715c134c25b // indirect + gorm.io/hints v1.1.0 // indirect + gorm.io/plugin/dbresolver v1.3.0 // indirect +) diff --git a/cmd/dumpper/go.sum b/cmd/dumpper/go.sum new file mode 100644 index 0000000..1451afe --- /dev/null +++ b/cmd/dumpper/go.sum @@ -0,0 +1,75 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= +github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= +github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c h1:jWdr7cHgl8c/ua5vYbR2WhSp+NQmzhsj0xoY3foTzW8= +gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c/go.mod h1:SH2K9R+2RMjuX1CkCONrPwoe9JzVv2hkQvEu4bXGojE= +gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/mysql v1.5.1-0.20230509030346-3715c134c25b h1:O7DuK4tml7U+sG1NJmGXz3LXaO6Goblps5Gx4NBuxis= +gorm.io/driver/mysql v1.5.1-0.20230509030346-3715c134c25b/go.mod h1:RpAr+f2lUtJUm0e2FAbttXiUKgAqKSUtzI1ulJfz9xU= +gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo= +gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0= +gorm.io/driver/sqlite v1.1.6/go.mod h1:W8LmC/6UvVbHKah0+QOC7Ja66EaZXHwUTjgXY8YNWX8= +gorm.io/driver/sqlite v1.4.3 h1:HBBcZSDnWi5BW3B3rwvVTc510KGkBkexlOg0QrmLUuU= +gorm.io/driver/sqlite v1.4.3/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI= +gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0= +gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHDnJLig= +gorm.io/gen v0.3.24 h1:yL1RrCySwTWTQpkUkt2FCe42Xub2eaZP2tM5EQoFBNU= +gorm.io/gen v0.3.24/go.mod h1:G9uxGfkfNFxPoOrV5P6KQxRMgZsQSCyp9vJP8xiKTGg= +gorm.io/gorm v1.21.15/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.22.2/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= +gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= +gorm.io/gorm v1.25.1-0.20230505075827-e61b98d69677/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/hints v1.1.0 h1:Lp4z3rxREufSdxn4qmkK3TLDltrM10FLTHiuqwDPvXw= +gorm.io/hints v1.1.0/go.mod h1:lKQ0JjySsPBj3uslFzY3JhYDtqEwzm+G1hv8rWujB6Y= +gorm.io/plugin/dbresolver v1.3.0 h1:uFDX3bIuH9Lhj5LY2oyqR/bU6pqWuDgas35NAPF4X3M= +gorm.io/plugin/dbresolver v1.3.0/go.mod h1:Pr7p5+JFlgDaiM6sOrli5olekJD16YRunMyA2S7ZfKk= diff --git a/cmd/dumpper/main.go b/cmd/dumpper/main.go new file mode 100644 index 0000000..d8f9112 --- /dev/null +++ b/cmd/dumpper/main.go @@ -0,0 +1,59 @@ +package main + +import ( + "gorm.io/driver/postgres" + "gorm.io/gen" + "gorm.io/gorm" +) + +func main() { + var dataMap = map[string]func(gorm.ColumnType) (dataType string){ + "ReqType": func(columnType gorm.ColumnType) (dataType string) { + if n, ok := columnType.Nullable(); ok && n { + return "*ReqType" + } + return "ReqType" + }, + + "TeamMemberRole": func(columnType gorm.ColumnType) (dataType string) { + if n, ok := columnType.Nullable(); ok && n { + return "*TeamMemberRole" + } + return "TeamMemberRole" + }, + "jsonb": func(columnType gorm.ColumnType) (dataType string) { + if n, ok := columnType.Nullable(); ok && n { + return "*JSONB" + } + return "JSONB" + }, + } + + g := gen.NewGenerator(gen.Config{ + // if you want the nullable field generation property to be pointer type, set FieldNullable true + FieldNullable: true, + // if you want to assign field which has a default value in the `Create` API, set FieldCoverable true, reference: https://gorm.io/docs/create.html#Default-Values + FieldCoverable: true, + // if you want to generate field with unsigned integer type, set FieldSignable true + FieldSignable: true, + // if you want to generate index tags from database, set FieldWithIndexTag true + FieldWithIndexTag: true, + // if you want to generate type tags from database, set FieldWithTypeTag true + FieldWithTypeTag: true, + // if you need unit tests for query code, set WithUnitTest true + WithUnitTest: true, + OutPath: "../models", + Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, // generate mode + }) + g.WithDataTypeMap(dataMap) + + gormdb, _ := gorm.Open(postgres.Open("postgres://postgres:example@127.0.0.1:5432/postgres?search_path=public")) + g.UseDB(gormdb) // reuse your gorm db + + g.ApplyBasic( + // Generate structs from all tables of current database + g.GenerateAllTable()..., + ) + // Generate the code + g.Execute() +} diff --git a/cmd/import-meta-env/go.mod b/cmd/import-meta-env/go.mod new file mode 100644 index 0000000..a8ee340 --- /dev/null +++ b/cmd/import-meta-env/go.mod @@ -0,0 +1,3 @@ +module import-meta-env + +go 1.21.5 diff --git a/cmd/import-meta-env/main.go b/cmd/import-meta-env/main.go new file mode 100644 index 0000000..9c1d420 --- /dev/null +++ b/cmd/import-meta-env/main.go @@ -0,0 +1,155 @@ +package main + +import ( + "encoding/json" + "fmt" + "log" + "os" + "path/filepath" + "regexp" + "strings" +) + +var scriptPlaceholder = `JSON.parse('"import_meta_env_placeholder"')` + +func prependSlash(char rune, count int) string { + return strings.Repeat(`\`, count*2) + string(char) +} + +func replace(input, pattern, replacement string) string { + return regexp.MustCompile(pattern).ReplaceAllString(input, replacement) +} + +func createScriptPlaceholderRegExp(doubleQuoteSlashCount, singleQuoteSlashCount int) *regexp.Regexp { + regexPattern := replace( + replace( + replace(scriptPlaceholder, `([\(\)])`, `\$1`), + `"`, + prependSlash('"', doubleQuoteSlashCount), + ), + `'`, + prependSlash('\'', singleQuoteSlashCount), + ) + + return regexp.MustCompile(regexPattern) +} + +func replaceAllPlaceholderWithEnv(code string, env map[string]string) string { + escapedEnv := make(map[string]string) + for key, value := range env { + escapedEnv[key] = strings.ReplaceAll(value, `"`, `\"`) + } + + // Replace placeholders in the code using regular expressions + code = replacePlaceholder(createScriptPlaceholderRegExp(2, 1), code, escapedEnv, 2) + code = replacePlaceholder(createScriptPlaceholderRegExp(1, 0), code, escapedEnv, 1) + code = replacePlaceholder(createScriptPlaceholderRegExp(0, 0), code, escapedEnv, 0) + + return code +} + +func replacePlaceholder(regex *regexp.Regexp, code string, escapedEnv map[string]string, doubleQuoteSlashCount int) string { + return regex.ReplaceAllStringFunc(code, func(match string) string { + // Serialize the escapedEnv map to a JSON string + serializedEnv, err := json.Marshal(escapedEnv) + if err != nil { + // Handle the error + fmt.Println("Error marshaling environment:", err) + return match + } + // Escape double quotes in the serialized JSON string + escapedSerializedEnv := string(serializedEnv) + if doubleQuoteSlashCount == 2 { + escapedSerializedEnv = strings.ReplaceAll(string(serializedEnv), `"`, `\\"`) + } else if doubleQuoteSlashCount == 1 { + escapedSerializedEnv = strings.ReplaceAll(string(serializedEnv), `"`, `\"`) + } + return fmt.Sprintf(`JSON.parse('%s')`, escapedSerializedEnv) + }) +} + +func shouldInjectEnv(code string) bool { + // Test whether the code contains placeholders using regular expressions + return createScriptPlaceholderRegExp(2, 1).MatchString(code) || + createScriptPlaceholderRegExp(1, 0).MatchString(code) || + createScriptPlaceholderRegExp(0, 0).MatchString(code) +} + +func isSourceMap(file string) bool { + return strings.HasSuffix(file, ".map") +} + +func isBackupFileName(file string) bool { + return strings.HasSuffix(file, ".bak") +} + +func main() { + + folder := os.Args[1] + envStr := os.Environ() + // Create a map of environment variables + env := make(map[string]string) + for _, e := range envStr { + pair := strings.SplitN(e, "=", 2) + if strings.HasPrefix(pair[0], "VITE_") { + env[pair[0]] = pair[1] + } + } + err := filepath.WalkDir(folder, + func(outputFileName string, info os.DirEntry, err error) error { + if err != nil { + return err + } + + // Skip directories, source maps, and backup file names + if info.IsDir() { + return nil + } + if isSourceMap(outputFileName) || isBackupFileName(outputFileName) { + return nil + } + + // Create a backup file name + // backupFileName := outputFileName + backupFileExt + // If not disposable, attempt to restore from backup + // if !opts.Disposable { + // tryToRestore(backupFileName) + // } + + // Read code from the output file + code, err := os.ReadFile(outputFileName) + if err != nil { + return fmt.Errorf("error reading file %s: %v", outputFileName, err) + } + + // Check if injection is needed + if !shouldInjectEnv(string(code)) { + return nil + } + + // If not disposable, create a backup + // if !opts.Disposable { + // err := os.WriteFile(backupFileName, code, 0644) + // if err != nil { + // return fmt.Errorf("Error creating backup file %s: %v\n", backupFileName, err) + // } + // } + + // Replace placeholders with environment variables + outputCode := replaceAllPlaceholderWithEnv(string(code), env) + // If code is unchanged, continue to the next file + if string(code) == outputCode { + return nil + } + + // Update the file with the modified code + err = os.WriteFile(outputFileName, []byte(outputCode), 0644) + if err != nil { + return fmt.Errorf("error writing to file %s: %v", outputFileName, err) + } + return nil + }) + if err != nil { + log.Println(err) + } +} diff --git a/cmd/server/go.mod b/cmd/server/go.mod new file mode 100644 index 0000000..9548b8c --- /dev/null +++ b/cmd/server/go.mod @@ -0,0 +1,31 @@ +module server + +go 1.21.5 + +require ( + github.com/99designs/gqlgen v0.17.42 + github.com/gorilla/websocket v1.5.0 + github.com/joho/godotenv v1.5.1 + github.com/rs/zerolog v1.31.0 + gorm.io/driver/postgres v1.5.4 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.3 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.4.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/sosodev/duration v1.1.0 // indirect + github.com/vektah/gqlparser/v2 v2.5.10 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect +) diff --git a/cmd/server/go.sum b/cmd/server/go.sum new file mode 100644 index 0000000..79b3311 --- /dev/null +++ b/cmd/server/go.sum @@ -0,0 +1,78 @@ +github.com/99designs/gqlgen v0.17.42 h1:BVWDOb2VVHQC5k3m6oa0XhDnxltLLrU4so7x/u39Zu4= +github.com/99designs/gqlgen v0.17.42/go.mod h1:GQ6SyMhwFbgHR0a8r2Wn8fYgEwPxxmndLFPhU63+cJE= +github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/golang-lru/v2 v2.0.3 h1:kmRrRLlInXvng0SmLxmQpQkpbYAvcXm7NPDrgxJa9mE= +github.com/hashicorp/golang-lru/v2 v2.0.3/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= +github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= +github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= +github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/sosodev/duration v1.1.0 h1:kQcaiGbJaIsRqgQy7VGlZrVw1giWO+lDoX3MCPnpVO4= +github.com/sosodev/duration v1.1.0/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/vektah/gqlparser/v2 v2.5.10 h1:6zSM4azXC9u4Nxy5YmdmGu4uKamfwsdKTwp5zsEealU= +github.com/vektah/gqlparser/v2 v2.5.10/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo= +gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/cmd/server/main.go b/cmd/server/main.go new file mode 100644 index 0000000..d65decc --- /dev/null +++ b/cmd/server/main.go @@ -0,0 +1,132 @@ +package main + +import ( + "net/http" + "os" + "time" + + "graph" + mw "middleware" + "model" + "rest" + + "github.com/99designs/gqlgen/graphql/handler" + "github.com/99designs/gqlgen/graphql/handler/extension" + "github.com/99designs/gqlgen/graphql/handler/lru" + "github.com/99designs/gqlgen/graphql/handler/transport" + "github.com/99designs/gqlgen/graphql/playground" + "github.com/gorilla/websocket" + "github.com/joho/godotenv" + "github.com/rs/zerolog/log" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +const ( + defaultPort = "8080" +) + +var ( + dsn string +) + +func init() { + if _, err := os.Stat(".env"); err == nil { + godotenv.Load(".env") + } + dsn = os.Getenv("DATABASE_URL") + if dsn == "" { + log.Fatal().Msg("DATABASE_URL is not set") + } +} + +func initDB(db *gorm.DB) { + + // Create the database. This is a one-time step. + // Comment out if running multiple times - You may see an error otherwise + // db.Exec("CREATE SCHEMA public") + // db.Exec("USE public") + + db.Exec("CREATE TYPE Team_Member_Role AS ENUM('OWNER', 'VIEWER', 'EDITOR');") + db.Exec("CREATE TYPE Req_Type AS ENUM('REST', 'GQL');") + + // Migration to create tables for Order and Item schema + db.AutoMigrate( + + &model.User{}, + &model.UserCollection{}, + &model.UserEnvironment{}, + &model.UserHistory{}, + &model.UserRequest{}, + &model.UserSetting{}, + &model.VerificationToken{}, + &model.Team{}, + &model.TeamCollection{}, + &model.TeamEnvironment{}, + &model.TeamInvitation{}, + &model.TeamMember{}, + &model.TeamRequest{}, + &model.Account{}, + &model.InfraConfig{}, + &model.InvitedUser{}, + &model.Shortcode{}, + ) +} + +func main() { + var err error + + // dataSourceName := "host=localhost user=gorm password=gorm dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai" + db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) + + if err != nil { + log.Fatal().Err(err).Msg("failed to connect database") + } + + // initDB(db) + + http.HandleFunc("/ping", rest.Ping) + + http.Handle("/v1/auth/", mw.LogMiddleware(mw.DBMiddleware(db, rest.ServeMux("/v1/auth/")))) + + // gqlgen config + c := graph.Config{Resolvers: &graph.Resolver{ + DB: db, + }} + // gqlgen Directives + c.Directives.IsAdmin = graph.IsAdmin + c.Directives.IsLogin = graph.IsLogin + + srv := handler.New(graph.NewExecutableSchema(c)) + + // Websocket support + srv.AddTransport(&transport.Websocket{ + KeepAlivePingInterval: 10 * time.Second, + Upgrader: websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { return true }, + }, + }) + srv.AddTransport(transport.Options{}) + srv.AddTransport(transport.GET{}) + srv.AddTransport(transport.POST{}) + // srv.AddTransport(transport.MultipartForm{}) + + srv.SetQueryCache(lru.New(1000)) + + srv.Use(extension.Introspection{}) + srv.Use(extension.AutomaticPersistedQuery{ + Cache: lru.New(100), + }) + + // Complexity Limit + srv.Use(extension.FixedComplexityLimit(50)) + + // playground + if os.Getenv("PRODUCTION") == "false" { + http.Handle("/", playground.Handler("GraphQL playground", "/graphql")) + } + http.Handle("/graphql", mw.LogMiddleware(mw.JwtMiddleware(mw.OperatorMiddleware(db, srv)))) + + log.Info().Msgf("listen on :%s", defaultPort) + log.Fatal().Err(http.ListenAndServe(":"+defaultPort, nil)).Msg("something went wrong") +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6fca213 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' +services: + postgres: + container_name: postgres + image: postgres + restart: always + environment: + POSTGRES_PASSWORD: example + ports: + - 5432:5432 + networks: + - hoppscotch + volumes: + - C:\Users\FLynn\Desktop\data\hoppscotch\data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + hoppscotch: + container_name: hoppscotch + image: ling7334/hoppscotch:latest + env_file: .env + ports: + - 3000:3000 + - 3100:3100 + - 3170:3170 + networks: + - hoppscotch + depends_on: + postgres: + condition: service_healthy +networks: + hoppscotch: + driver: bridge \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..3cf50c7 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/ling7334/hoppscotch-backend-go + +go 1.21.5 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000..aa59461 --- /dev/null +++ b/go.work.sum @@ -0,0 +1,55 @@ +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= +github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= +github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= +github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM= +github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/moby/pubsub v1.0.0 h1:jkp/imWsmJz2f6LyFsk7EkVeN2HxR/HTTOY8kHrsxfA= +github.com/moby/pubsub v1.0.0/go.mod h1:bXSO+3h5MNXXCaEG+6/NlAIk7MMZbySZlnB+cUQhKKc= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/urfave/cli/v2 v2.25.5 h1:d0NIAyhh5shGscroL7ek/Ya9QYQE0KNabJgiUinIQkc= +github.com/urfave/cli/v2 v2.25.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c= +gorm.io/driver/sqlite v1.5.4 h1:IqXwXi8M/ZlPzH/947tn5uik3aYQslP9BVveoax0nV0= +gorm.io/driver/sqlite v1.5.4/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/plugin/dbresolver v1.5.0 h1:XVHLxh775eP0CqVh3vcfJtYqja3uFl5Wr3cKlY8jgDY= +gorm.io/plugin/dbresolver v1.5.0/go.mod h1:l4Cn87EHLEYuqUncpEeTC2tTJQkjngPSD+lo8hIvcT0= diff --git a/gqlgen.yml b/gqlgen.yml new file mode 100644 index 0000000..3eea33d --- /dev/null +++ b/gqlgen.yml @@ -0,0 +1,173 @@ +# Where are all the schema files located? globs are supported eg src/**/*.graphqls +schema: + - api/graphql/*.graphqls + +# Where should the generated server code go? +exec: + filename: internal/graph/generated.go + package: graph + +# Uncomment to enable federation +# federation: +# filename: graph/federation.go +# package: graph + +# Where should any generated models go? +model: + filename: internal/graph/dto/models_gen.go + package: dto + +# Where should the resolver implementations go? +resolver: + layout: follow-schema + dir: internal/graph + package: graph + filename_template: "{name}.resolvers.go" + # Optional: turn on to not generate template comments above resolvers + omit_template_comment: true + +# Optional: turn on use ` + "`" + `gqlgen:"fieldName"` + "`" + ` tags in your models +# struct_tag: json + +# Optional: turn on to use []Thing instead of []*Thing +# omit_slice_element_pointers: false + +# Optional: turn on to omit Is() methods to interface and unions +# omit_interface_checks : true + +# Optional: turn on to skip generation of ComplexityRoot struct content and Complexity function +# omit_complexity: false + +# Optional: turn on to not generate any file notice comments in generated files +# omit_gqlgen_file_notice: false + +# Optional: turn on to exclude the gqlgen version in the generated file notice. No effect if `omit_gqlgen_file_notice` is true. +# omit_gqlgen_version_in_file_notice: false + +# Optional: turn off to make struct-type struct fields not use pointers +# e.g. type Thing struct { FieldA OtherThing } instead of { FieldA *OtherThing } +# struct_fields_always_pointers: true + +# Optional: turn off to make resolvers return values instead of pointers for structs +# resolvers_always_return_pointers: true + +# Optional: turn on to return pointers instead of values in unmarshalInput +# return_pointers_in_unmarshalinput: false + +# Optional: wrap nullable input fields with Omittable +# nullable_input_omittable: true + +# Optional: set to speed up generation time by not performing a final validation pass. +# skip_validation: true + +# Optional: set to skip running `go mod tidy` when generating server code +# skip_mod_tidy: true + +# gqlgen will search for any type names in the schema in these go packages +# if they match it will use them, otherwise it will generate them. +autobind: + # - "pkg/model" + +# This section declares type mapping between the GraphQL and go type systems +# +# The first line in each type will be used as defaults for resolver arguments and +# modelgen, the others will be allowed when binding to fields. Configure them to +# your liking +models: + ID: + model: + - github.com/99designs/gqlgen/graphql.ID + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + Int: + model: + - github.com/99designs/gqlgen/graphql.Int + - github.com/99designs/gqlgen/graphql.Int64 + - github.com/99designs/gqlgen/graphql.Int32 + + DateTime: + model: graph.DateTimeScalar + + ReqType: + model: model.ReqType + + SessionType: + model: model.ReqType + + TeamMemberRole: + model: model.TeamMemberRole + + User: + model: model.User + fields: + globalEnvironments: + resolver: true + RESTHistory: + resolver: true + GQLHistory: + resolver: true + + UserSettings: + model: model.UserSetting + + UserEnvironment: + model: model.UserEnvironment + + UserCollection: + model: model.UserCollection + fields: + childrenREST: + resolver: true + childrenGQL: + resolver: true + + UserRequest: + model: model.UserRequest + + UserHistory: + model: model.UserHistory + + Team: + model: model.Team + fields: + teamInvitations: + resolver: true + teamEnvironments: + resolver: true + ownersCount: + resolver: true + editorsCount: + resolver: true + viewersCount: + resolver: true + + TeamMember: + model: model.TeamMember + fields: + membershipID: + fieldName: ID + + TeamEnvironment: + model: model.TeamEnvironment + + TeamCollection: + model: model.TeamCollection + + TeamRequest: + model: model.TeamRequest + + TeamInvitation: + model: model.TeamInvitation + + InvitedUser: + model: model.InvitedUser + + Shortcode: + model: model.Shortcode + fields: + properties: + fieldName: EmbedProperties + + InfraConfig: + model: model.InfraConfig diff --git a/healthcheck.sh b/healthcheck.sh new file mode 100644 index 0000000..21178dc --- /dev/null +++ b/healthcheck.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +curlCheck() { + if ! curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].."; then + echo "URL request failed!" + exit 1 + else + echo "URL request succeeded!" + fi +} + +curlCheck "http://localhost:3000" +curlCheck "http://localhost:3100" +curlCheck "http://localhost:3170/ping" \ No newline at end of file diff --git a/import-meta-env b/import-meta-env new file mode 100644 index 0000000..f46eaa3 Binary files /dev/null and b/import-meta-env differ diff --git a/internal/graph/directive.go b/internal/graph/directive.go new file mode 100644 index 0000000..cc8c2a4 --- /dev/null +++ b/internal/graph/directive.go @@ -0,0 +1,29 @@ +package graph + +import ( + "context" + mw "middleware" + "model" + + ex "exception" + + "github.com/99designs/gqlgen/graphql" + "github.com/rs/zerolog/log" +) + +func IsAdmin(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { + log.Info().Any("obj", obj).Msg("IsAdmin") + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !(ok && user.IsAdmin) { + return nil, ex.ErrAuthFail + } + return next(ctx) +} +func IsLogin(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) { + log.Info().Any("obj", obj).Msg("IsLogIn") + _, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrAuthFail + } + return next(ctx) +} diff --git a/internal/graph/dto/go.mod b/internal/graph/dto/go.mod new file mode 100644 index 0000000..450857b --- /dev/null +++ b/internal/graph/dto/go.mod @@ -0,0 +1,3 @@ +module dto + +go 1.21.5 diff --git a/internal/graph/dto/models_gen.go b/internal/graph/dto/models_gen.go new file mode 100644 index 0000000..10940c8 --- /dev/null +++ b/internal/graph/dto/models_gen.go @@ -0,0 +1,338 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package dto + +import ( + "fmt" + "io" + "model" + "strconv" + "time" +) + +type Admin struct { + // UID of the user + UID string `json:"uid"` + // Name of the user (if fetched) + DisplayName *string `json:"displayName,omitempty"` + // Email of the user + Email *string `json:"email,omitempty"` + // URL to the profile photo of the user (if fetched) + PhotoURL *string `json:"photoURL,omitempty"` + // Date when the user account was created + CreatedOn time.Time `json:"createdOn"` + // Returns a list of all admin users in infra + Admins []*model.User `json:"admins"` + // Returns a user info by UID + UserInfo *model.User `json:"userInfo"` + // Returns a list of all the users in infra + AllUsers []*model.User `json:"allUsers"` + // Returns a list of all the invited users + InvitedUsers []*model.InvitedUser `json:"invitedUsers"` + // Returns a list of all the teams in the infra + AllTeams []*model.Team `json:"allTeams"` + // Returns a team info by ID when requested by Admin + TeamInfo *model.Team `json:"teamInfo"` + // Return count of all the members in a team + MembersCountInTeam int `json:"membersCountInTeam"` + // Return count of all the stored collections in a team + CollectionCountInTeam int `json:"collectionCountInTeam"` + // Return count of all the stored requests in a team + RequestCountInTeam int `json:"requestCountInTeam"` + // Return count of all the stored environments in a team + EnvironmentCountInTeam int `json:"environmentCountInTeam"` + // Return all the pending invitations in a team + PendingInvitationCountInTeam []*model.TeamInvitation `json:"pendingInvitationCountInTeam"` + // Return total number of Users in organization + UsersCount int `json:"usersCount"` + // Return total number of Teams in organization + TeamsCount int `json:"teamsCount"` + // Return total number of Team Collections in organization + TeamCollectionsCount int `json:"teamCollectionsCount"` + // Return total number of Team Requests in organization + TeamRequestsCount int `json:"teamRequestsCount"` +} + +type CollectionReorderData struct { + // Team Collection being moved + Collection *model.TeamCollection `json:"collection"` + // Team Collection succeeding the collection being moved in its new position + NextCollection *model.TeamCollection `json:"nextCollection,omitempty"` +} + +type CreateTeamRequestInput struct { + // ID of the team the collection belongs to + TeamID string `json:"teamID"` + // JSON string representing the request data + Request string `json:"request"` + // Displayed title of the request + Title string `json:"title"` +} + +type EnableAndDisableSSOArgs struct { + // Auth Provider + Provider AuthProvider `json:"provider"` + // Auth Provider Status + Status ServiceStatus `json:"status"` +} + +type Infra struct { + // Admin who executed the action + ExecutedBy *Admin `json:"executedBy"` + // Returns a list of all admin users in infra + Admins []*model.User `json:"admins"` + // Returns a user info by UID + UserInfo *model.User `json:"userInfo"` + // Returns a list of all the users in infra + AllUsers []*model.User `json:"allUsers"` + // Returns a list of all the invited users + InvitedUsers []*model.InvitedUser `json:"invitedUsers"` + // Returns a list of all the teams in the infra + AllTeams []*model.Team `json:"allTeams"` + // Returns a team info by ID when requested by Admin + TeamInfo *model.Team `json:"teamInfo"` + // Return count of all the members in a team + MembersCountInTeam int `json:"membersCountInTeam"` + // Return count of all the stored collections in a team + CollectionCountInTeam int `json:"collectionCountInTeam"` + // Return count of all the stored requests in a team + RequestCountInTeam int `json:"requestCountInTeam"` + // Return count of all the stored environments in a team + EnvironmentCountInTeam int `json:"environmentCountInTeam"` + // Return all the pending invitations in a team + PendingInvitationCountInTeam []*model.TeamInvitation `json:"pendingInvitationCountInTeam"` + // Return total number of Users in organization + UsersCount int `json:"usersCount"` + // Return total number of Teams in organization + TeamsCount int `json:"teamsCount"` + // Return total number of Team Collections in organization + TeamCollectionsCount int `json:"teamCollectionsCount"` + // Return total number of Team Requests in organization + TeamRequestsCount int `json:"teamRequestsCount"` + // Returns a list of all the shortcodes in the infra + AllShortcodes []*ShortcodeWithUserEmail `json:"allShortcodes"` +} + +type InfraConfigArgs struct { + // Infra Config Name + Name InfraConfigEnum `json:"name"` + // Infra Config Value + Value string `json:"value"` +} + +type Mutation struct { +} + +type Query struct { +} + +type RequestReorderData struct { + // Team Request being moved + Request *model.TeamRequest `json:"request"` + // Team Request succeeding the request being moved in its new position + NextRequest *model.TeamRequest `json:"nextRequest,omitempty"` +} + +type ShortcodeCreator struct { + // Uid of user who created the shortcode + UID string `json:"uid"` + // Email of user who created the shortcode + Email string `json:"email"` +} + +type ShortcodeWithUserEmail struct { + // The 12 digit alphanumeric code + ID string `json:"id"` + // JSON string representing the request data + Request string `json:"request"` + // JSON string representing the properties for an embed + Properties *string `json:"properties,omitempty"` + // Timestamp of when the Shortcode was created + CreatedOn time.Time `json:"createdOn"` + // Details of user who created the shortcode + Creator *ShortcodeCreator `json:"creator,omitempty"` +} + +type Subscription struct { +} + +type UpdateTeamRequestInput struct { + // JSON string representing the request data + Request *string `json:"request,omitempty"` + // Displayed title of the request + Title *string `json:"title,omitempty"` +} + +type UserCollectionExportJSONData struct { + // Stringified contents of the collection + ExportedCollection string `json:"exportedCollection"` + // Type of the user collection + CollectionType model.ReqType `json:"collectionType"` +} + +type UserCollectionRemovedData struct { + // ID of User Collection being removed + ID string `json:"id"` + // Type of the user collection + Type model.ReqType `json:"type"` +} + +type UserCollectionReorderData struct { + // User Collection being moved + UserCollection *model.UserCollection `json:"userCollection"` + // User Collection succeeding the collection being moved in its new position + NextUserCollection *model.UserCollection `json:"nextUserCollection,omitempty"` +} + +type UserHistoryDeletedManyData struct { + // Number of user histories deleted + Count int `json:"count"` + // Type of the request in the history + ReqType model.ReqType `json:"reqType"` +} + +type UserRequestReorderData struct { + // User request being moved + Request *model.UserRequest `json:"request"` + // User request succeeding the request being moved in its new position + NextRequest *model.UserRequest `json:"nextRequest,omitempty"` +} + +type AuthProvider string + +const ( + AuthProviderGoogle AuthProvider = "GOOGLE" + AuthProviderGithub AuthProvider = "GITHUB" + AuthProviderMicrosoft AuthProvider = "MICROSOFT" + AuthProviderEmail AuthProvider = "EMAIL" +) + +var AllAuthProvider = []AuthProvider{ + AuthProviderGoogle, + AuthProviderGithub, + AuthProviderMicrosoft, + AuthProviderEmail, +} + +func (e AuthProvider) IsValid() bool { + switch e { + case AuthProviderGoogle, AuthProviderGithub, AuthProviderMicrosoft, AuthProviderEmail: + return true + } + return false +} + +func (e AuthProvider) String() string { + return string(e) +} + +func (e *AuthProvider) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = AuthProvider(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid AuthProvider", str) + } + return nil +} + +func (e AuthProvider) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type InfraConfigEnum string + +const ( + InfraConfigEnumMailerSMTPURL InfraConfigEnum = "MAILER_SMTP_URL" + InfraConfigEnumMailerAddressFrom InfraConfigEnum = "MAILER_ADDRESS_FROM" + InfraConfigEnumGoogleClientID InfraConfigEnum = "GOOGLE_CLIENT_ID" + InfraConfigEnumGoogleClientSecret InfraConfigEnum = "GOOGLE_CLIENT_SECRET" + InfraConfigEnumGithubClientID InfraConfigEnum = "GITHUB_CLIENT_ID" + InfraConfigEnumGithubClientSecret InfraConfigEnum = "GITHUB_CLIENT_SECRET" + InfraConfigEnumMicrosoftClientID InfraConfigEnum = "MICROSOFT_CLIENT_ID" + InfraConfigEnumMicrosoftClientSecret InfraConfigEnum = "MICROSOFT_CLIENT_SECRET" +) + +var AllInfraConfigEnum = []InfraConfigEnum{ + InfraConfigEnumMailerSMTPURL, + InfraConfigEnumMailerAddressFrom, + InfraConfigEnumGoogleClientID, + InfraConfigEnumGoogleClientSecret, + InfraConfigEnumGithubClientID, + InfraConfigEnumGithubClientSecret, + InfraConfigEnumMicrosoftClientID, + InfraConfigEnumMicrosoftClientSecret, +} + +func (e InfraConfigEnum) IsValid() bool { + switch e { + case InfraConfigEnumMailerSMTPURL, InfraConfigEnumMailerAddressFrom, InfraConfigEnumGoogleClientID, InfraConfigEnumGoogleClientSecret, InfraConfigEnumGithubClientID, InfraConfigEnumGithubClientSecret, InfraConfigEnumMicrosoftClientID, InfraConfigEnumMicrosoftClientSecret: + return true + } + return false +} + +func (e InfraConfigEnum) String() string { + return string(e) +} + +func (e *InfraConfigEnum) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = InfraConfigEnum(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid InfraConfigEnum", str) + } + return nil +} + +func (e InfraConfigEnum) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} + +type ServiceStatus string + +const ( + ServiceStatusEnable ServiceStatus = "ENABLE" + ServiceStatusDisable ServiceStatus = "DISABLE" +) + +var AllServiceStatus = []ServiceStatus{ + ServiceStatusEnable, + ServiceStatusDisable, +} + +func (e ServiceStatus) IsValid() bool { + switch e { + case ServiceStatusEnable, ServiceStatusDisable: + return true + } + return false +} + +func (e ServiceStatus) String() string { + return string(e) +} + +func (e *ServiceStatus) UnmarshalGQL(v interface{}) error { + str, ok := v.(string) + if !ok { + return fmt.Errorf("enums must be strings") + } + + *e = ServiceStatus(str) + if !e.IsValid() { + return fmt.Errorf("%s is not a valid ServiceStatus", str) + } + return nil +} + +func (e ServiceStatus) MarshalGQL(w io.Writer) { + fmt.Fprint(w, strconv.Quote(e.String())) +} diff --git a/internal/graph/generated.go b/internal/graph/generated.go new file mode 100644 index 0000000..7c46611 --- /dev/null +++ b/internal/graph/generated.go @@ -0,0 +1,33243 @@ +// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. + +package graph + +import ( + "bytes" + "context" + "dto" + "errors" + "fmt" + "io" + "model" + "strconv" + "sync" + "sync/atomic" + "time" + + "github.com/99designs/gqlgen/graphql" + "github.com/99designs/gqlgen/graphql/introspection" + gqlparser "github.com/vektah/gqlparser/v2" + "github.com/vektah/gqlparser/v2/ast" +) + +// region ************************** generated!.gotpl ************************** + +// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. +func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { + return &executableSchema{ + schema: cfg.Schema, + resolvers: cfg.Resolvers, + directives: cfg.Directives, + complexity: cfg.Complexity, + } +} + +type Config struct { + Schema *ast.Schema + Resolvers ResolverRoot + Directives DirectiveRoot + Complexity ComplexityRoot +} + +type ResolverRoot interface { + Mutation() MutationResolver + Query() QueryResolver + Subscription() SubscriptionResolver + Team() TeamResolver + User() UserResolver + UserCollection() UserCollectionResolver +} + +type DirectiveRoot struct { + IsAdmin func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) + IsLogin func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) +} + +type ComplexityRoot struct { + Admin struct { + Admins func(childComplexity int) int + AllTeams func(childComplexity int, cursor *string, take *int) int + AllUsers func(childComplexity int, cursor *string, take *int) int + CollectionCountInTeam func(childComplexity int, teamID string) int + CreatedOn func(childComplexity int) int + DisplayName func(childComplexity int) int + Email func(childComplexity int) int + EnvironmentCountInTeam func(childComplexity int, teamID string) int + InvitedUsers func(childComplexity int) int + MembersCountInTeam func(childComplexity int, teamID string) int + PendingInvitationCountInTeam func(childComplexity int, teamID string) int + PhotoURL func(childComplexity int) int + RequestCountInTeam func(childComplexity int, teamID string) int + TeamCollectionsCount func(childComplexity int) int + TeamInfo func(childComplexity int, teamID string) int + TeamRequestsCount func(childComplexity int) int + TeamsCount func(childComplexity int) int + UID func(childComplexity int) int + UserInfo func(childComplexity int, userUID string) int + UsersCount func(childComplexity int) int + } + + CollectionReorderData struct { + Collection func(childComplexity int) int + NextCollection func(childComplexity int) int + } + + Infra struct { + Admins func(childComplexity int) int + AllShortcodes func(childComplexity int, cursor *string, take *int, userEmail *string) int + AllTeams func(childComplexity int, cursor *string, take *int) int + AllUsers func(childComplexity int, cursor *string, take *int) int + CollectionCountInTeam func(childComplexity int, teamID string) int + EnvironmentCountInTeam func(childComplexity int, teamID string) int + ExecutedBy func(childComplexity int) int + InvitedUsers func(childComplexity int) int + MembersCountInTeam func(childComplexity int, teamID string) int + PendingInvitationCountInTeam func(childComplexity int, teamID string) int + RequestCountInTeam func(childComplexity int, teamID string) int + TeamCollectionsCount func(childComplexity int) int + TeamInfo func(childComplexity int, teamID string) int + TeamRequestsCount func(childComplexity int) int + TeamsCount func(childComplexity int) int + UserInfo func(childComplexity int, userUID string) int + UsersCount func(childComplexity int) int + } + + InfraConfig struct { + Name func(childComplexity int) int + Value func(childComplexity int) int + } + + InvitedUser struct { + AdminEmail func(childComplexity int) int + AdminUID func(childComplexity int) int + InvitedOn func(childComplexity int) int + InviteeEmail func(childComplexity int) int + } + + Mutation struct { + AcceptTeamInvitation func(childComplexity int, inviteID string) int + AddUserToTeamByAdmin func(childComplexity int, teamID string, role model.TeamMemberRole, userEmail string) int + ChangeUserRoleInTeamByAdmin func(childComplexity int, userUID string, teamID string, newRole model.TeamMemberRole) int + ClearGlobalEnvironments func(childComplexity int, id string) int + CreateChildCollection func(childComplexity int, collectionID string, childTitle string, data *string) int + CreateDuplicateEnvironment func(childComplexity int, id string) int + CreateGQLChildUserCollection func(childComplexity int, title string, parentUserCollectionID string, data *string) int + CreateGQLRootUserCollection func(childComplexity int, title string, data *string) int + CreateGQLUserRequest func(childComplexity int, collectionID string, title string, request string) int + CreateRESTChildUserCollection func(childComplexity int, title string, parentUserCollectionID string, data *string) int + CreateRESTRootUserCollection func(childComplexity int, title string, data *string) int + CreateRESTUserRequest func(childComplexity int, collectionID string, title string, request string) int + CreateRequestInCollection func(childComplexity int, collectionID string, data dto.CreateTeamRequestInput) int + CreateRootCollection func(childComplexity int, teamID string, title string, data *string) int + CreateShortcode func(childComplexity int, request string, properties *string) int + CreateTeam func(childComplexity int, name string) int + CreateTeamByAdmin func(childComplexity int, userUID string, name string) int + CreateTeamEnvironment func(childComplexity int, name string, teamID string, variables string) int + CreateTeamInvitation func(childComplexity int, teamID string, inviteeEmail string, inviteeRole model.TeamMemberRole) int + CreateUserEnvironment func(childComplexity int, name string, variables string) int + CreateUserGlobalEnvironment func(childComplexity int, variables string) int + CreateUserHistory func(childComplexity int, reqData string, resMetadata string, reqType model.ReqType) int + CreateUserSettings func(childComplexity int, properties string) int + DeleteAllUserHistory func(childComplexity int, reqType model.ReqType) int + DeleteAllVariablesFromTeamEnvironment func(childComplexity int, id string) int + DeleteCollection func(childComplexity int, collectionID string) int + DeleteRequest func(childComplexity int, requestID string) int + DeleteTeam func(childComplexity int, teamID string) int + DeleteTeamByAdmin func(childComplexity int, teamID string) int + DeleteTeamEnvironment func(childComplexity int, id string) int + DeleteUser func(childComplexity int) int + DeleteUserCollection func(childComplexity int, userCollectionID string) int + DeleteUserEnvironment func(childComplexity int, id string) int + DeleteUserEnvironments func(childComplexity int) int + DeleteUserRequest func(childComplexity int, id string) int + EnableAndDisableSso func(childComplexity int, providerInfo []*dto.EnableAndDisableSSOArgs) int + ImportCollectionsFromJSON func(childComplexity int, teamID string, jsonString string, parentCollectionID *string) int + ImportUserCollectionsFromJSON func(childComplexity int, jsonString string, reqType model.ReqType, parentCollectionID *string) int + InviteNewUser func(childComplexity int, inviteeEmail string) int + LeaveTeam func(childComplexity int, teamID string) int + MakeUserAdmin func(childComplexity int, userUID string) int + MoveCollection func(childComplexity int, parentCollectionID *string, collectionID string) int + MoveRequest func(childComplexity int, srcCollID *string, requestID string, destCollID string, nextRequestID *string) int + MoveUserCollection func(childComplexity int, destCollectionID *string, userCollectionID string) int + MoveUserRequest func(childComplexity int, sourceCollectionID string, requestID string, destinationCollectionID string, nextRequestID *string) int + RemoveRequestFromHistory func(childComplexity int, id string) int + RemoveTeamMember func(childComplexity int, teamID string, userUID string) int + RemoveUserAsAdmin func(childComplexity int, userUID string) int + RemoveUserByAdmin func(childComplexity int, userUID string) int + RemoveUserFromTeamByAdmin func(childComplexity int, userUID string, teamID string) int + RenameCollection func(childComplexity int, collectionID string, newTitle string) int + RenameTeam func(childComplexity int, teamID string, newName string) int + RenameTeamByAdmin func(childComplexity int, teamID string, newName string) int + RenameUserCollection func(childComplexity int, userCollectionID string, newTitle string) int + ReplaceCollectionsWithJSON func(childComplexity int, teamID string, jsonString string, parentCollectionID *string) int + ResetInfraConfigs func(childComplexity int) int + RevokeShortcode func(childComplexity int, code string) int + RevokeShortcodeByAdmin func(childComplexity int, code string) int + RevokeTeamInvitation func(childComplexity int, inviteID string) int + RevokeTeamInviteByAdmin func(childComplexity int, inviteID string) int + ToggleHistoryStarStatus func(childComplexity int, id string) int + UpdateCollectionOrder func(childComplexity int, collectionID string, destCollID *string) int + UpdateEmbedProperties func(childComplexity int, code string, properties string) int + UpdateGQLUserRequest func(childComplexity int, id string, title *string, request *string) int + UpdateInfraConfigs func(childComplexity int, infraConfigs []*dto.InfraConfigArgs) int + UpdateLookUpRequestOrder func(childComplexity int, collectionID string, nextRequestID *string, requestID string) int + UpdateRESTUserRequest func(childComplexity int, id string, title *string, request *string) int + UpdateRequest func(childComplexity int, requestID string, data dto.UpdateTeamRequestInput) int + UpdateTeamCollection func(childComplexity int, collectionID string, newTitle *string, data *string) int + UpdateTeamEnvironment func(childComplexity int, id string, name string, variables string) int + UpdateTeamMemberRole func(childComplexity int, teamID string, userUID string, newRole model.TeamMemberRole) int + UpdateUserCollection func(childComplexity int, userCollectionID string, newTitle *string, data *string) int + UpdateUserCollectionOrder func(childComplexity int, collectionID string, nextCollectionID *string) int + UpdateUserEnvironment func(childComplexity int, id string, name string, variables string) int + UpdateUserSessions func(childComplexity int, currentSession string, sessionType model.ReqType) int + UpdateUserSettings func(childComplexity int, properties string) int + } + + Query struct { + Admin func(childComplexity int) int + AllowedAuthProviders func(childComplexity int) int + Collection func(childComplexity int, collectionID string) int + ExportCollectionsToJSON func(childComplexity int, teamID string) int + ExportUserCollectionsToJSON func(childComplexity int, collectionID *string, collectionType model.ReqType) int + Infra func(childComplexity int) int + InfraConfigs func(childComplexity int, configNames []dto.InfraConfigEnum) int + Me func(childComplexity int) int + MyShortcodes func(childComplexity int, cursor *string, take *int) int + MyTeams func(childComplexity int, cursor *string) int + Request func(childComplexity int, requestID string) int + RequestsInCollection func(childComplexity int, cursor *string, take *int, collectionID string) int + RootCollectionsOfTeam func(childComplexity int, cursor *string, take *int, teamID string) int + RootGQLUserCollections func(childComplexity int, cursor *string, take *int) int + RootRESTUserCollections func(childComplexity int, cursor *string, take *int) int + SearchForRequest func(childComplexity int, cursor *string, take *int, teamID string, searchTerm string) int + Shortcode func(childComplexity int, code string) int + Team func(childComplexity int, teamID string) int + TeamInvitation func(childComplexity int, inviteID string) int + UserCollection func(childComplexity int, userCollectionID string) int + UserGQLRequests func(childComplexity int, cursor *string, take *int, collectionID *string) int + UserRESTRequests func(childComplexity int, cursor *string, take *int, collectionID *string) int + UserRequest func(childComplexity int, id string) int + } + + RequestReorderData struct { + NextRequest func(childComplexity int) int + Request func(childComplexity int) int + } + + Shortcode struct { + CreatedOn func(childComplexity int) int + EmbedProperties func(childComplexity int) int + ID func(childComplexity int) int + Request func(childComplexity int) int + } + + ShortcodeCreator struct { + Email func(childComplexity int) int + UID func(childComplexity int) int + } + + ShortcodeWithUserEmail struct { + CreatedOn func(childComplexity int) int + Creator func(childComplexity int) int + ID func(childComplexity int) int + Properties func(childComplexity int) int + Request func(childComplexity int) int + } + + Subscription struct { + CollectionOrderUpdated func(childComplexity int, teamID string) int + MyShortcodesCreated func(childComplexity int) int + MyShortcodesRevoked func(childComplexity int) int + MyShortcodesUpdated func(childComplexity int) int + RequestMoved func(childComplexity int, teamID string) int + RequestOrderUpdated func(childComplexity int, teamID string) int + TeamCollectionAdded func(childComplexity int, teamID string) int + TeamCollectionMoved func(childComplexity int, teamID string) int + TeamCollectionRemoved func(childComplexity int, teamID string) int + TeamCollectionUpdated func(childComplexity int, teamID string) int + TeamEnvironmentCreated func(childComplexity int, teamID string) int + TeamEnvironmentDeleted func(childComplexity int, teamID string) int + TeamEnvironmentUpdated func(childComplexity int, teamID string) int + TeamInvitationAdded func(childComplexity int, teamID string) int + TeamInvitationRemoved func(childComplexity int, teamID string) int + TeamMemberAdded func(childComplexity int, teamID string) int + TeamMemberRemoved func(childComplexity int, teamID string) int + TeamMemberUpdated func(childComplexity int, teamID string) int + TeamRequestAdded func(childComplexity int, teamID string) int + TeamRequestDeleted func(childComplexity int, teamID string) int + TeamRequestUpdated func(childComplexity int, teamID string) int + UserCollectionCreated func(childComplexity int) int + UserCollectionMoved func(childComplexity int) int + UserCollectionOrderUpdated func(childComplexity int) int + UserCollectionRemoved func(childComplexity int) int + UserCollectionUpdated func(childComplexity int) int + UserDeleted func(childComplexity int) int + UserEnvironmentCreated func(childComplexity int) int + UserEnvironmentDeleteMany func(childComplexity int) int + UserEnvironmentDeleted func(childComplexity int) int + UserEnvironmentUpdated func(childComplexity int) int + UserHistoryCreated func(childComplexity int) int + UserHistoryDeleted func(childComplexity int) int + UserHistoryDeletedMany func(childComplexity int) int + UserHistoryUpdated func(childComplexity int) int + UserInvited func(childComplexity int) int + UserRequestCreated func(childComplexity int) int + UserRequestDeleted func(childComplexity int) int + UserRequestMoved func(childComplexity int) int + UserRequestUpdated func(childComplexity int) int + UserSettingsCreated func(childComplexity int) int + UserSettingsUpdated func(childComplexity int) int + UserUpdated func(childComplexity int) int + } + + Team struct { + EditorsCount func(childComplexity int) int + ID func(childComplexity int) int + Members func(childComplexity int, cursor *string) int + MyRole func(childComplexity int) int + Name func(childComplexity int) int + OwnersCount func(childComplexity int) int + TeamEnvironments func(childComplexity int) int + TeamInvitations func(childComplexity int) int + TeamMembers func(childComplexity int) int + ViewersCount func(childComplexity int) int + } + + TeamCollection struct { + Children func(childComplexity int, cursor *string, take *int) int + Data func(childComplexity int) int + ID func(childComplexity int) int + Parent func(childComplexity int) int + ParentID func(childComplexity int) int + Team func(childComplexity int) int + Title func(childComplexity int) int + } + + TeamEnvironment struct { + ID func(childComplexity int) int + Name func(childComplexity int) int + TeamID func(childComplexity int) int + Variables func(childComplexity int) int + } + + TeamInvitation struct { + Creator func(childComplexity int) int + CreatorUID func(childComplexity int) int + ID func(childComplexity int) int + InviteeEmail func(childComplexity int) int + InviteeRole func(childComplexity int) int + Team func(childComplexity int) int + TeamID func(childComplexity int) int + } + + TeamMember struct { + ID func(childComplexity int) int + Role func(childComplexity int) int + User func(childComplexity int) int + } + + TeamRequest struct { + Collection func(childComplexity int) int + CollectionID func(childComplexity int) int + ID func(childComplexity int) int + Request func(childComplexity int) int + Team func(childComplexity int) int + TeamID func(childComplexity int) int + Title func(childComplexity int) int + } + + User struct { + CreatedOn func(childComplexity int) int + CurrentGQLSession func(childComplexity int) int + CurrentRESTSession func(childComplexity int) int + DisplayName func(childComplexity int) int + Email func(childComplexity int) int + Environments func(childComplexity int) int + GQLHistory func(childComplexity int, cursor *string, take *int) int + GlobalEnvironments func(childComplexity int) int + IsAdmin func(childComplexity int) int + PhotoURL func(childComplexity int) int + RESTHistory func(childComplexity int, cursor *string, take *int) int + Settings func(childComplexity int) int + UID func(childComplexity int) int + } + + UserCollection struct { + ChildrenGql func(childComplexity int, cursor *string, take *int) int + ChildrenRest func(childComplexity int, cursor *string, take *int) int + Data func(childComplexity int) int + ID func(childComplexity int) int + Parent func(childComplexity int) int + Requests func(childComplexity int, cursor *string, take *int) int + Title func(childComplexity int) int + Type func(childComplexity int) int + User func(childComplexity int) int + } + + UserCollectionExportJSONData struct { + CollectionType func(childComplexity int) int + ExportedCollection func(childComplexity int) int + } + + UserCollectionRemovedData struct { + ID func(childComplexity int) int + Type func(childComplexity int) int + } + + UserCollectionReorderData struct { + NextUserCollection func(childComplexity int) int + UserCollection func(childComplexity int) int + } + + UserEnvironment struct { + ID func(childComplexity int) int + IsGlobal func(childComplexity int) int + Name func(childComplexity int) int + UserUID func(childComplexity int) int + Variables func(childComplexity int) int + } + + UserHistory struct { + ExecutedOn func(childComplexity int) int + ID func(childComplexity int) int + IsStarred func(childComplexity int) int + ReqType func(childComplexity int) int + Request func(childComplexity int) int + ResponseMetadata func(childComplexity int) int + UserUID func(childComplexity int) int + } + + UserHistoryDeletedManyData struct { + Count func(childComplexity int) int + ReqType func(childComplexity int) int + } + + UserRequest struct { + CollectionID func(childComplexity int) int + CreatedOn func(childComplexity int) int + ID func(childComplexity int) int + Request func(childComplexity int) int + Title func(childComplexity int) int + Type func(childComplexity int) int + User func(childComplexity int) int + } + + UserRequestReorderData struct { + NextRequest func(childComplexity int) int + Request func(childComplexity int) int + } + + UserSettings struct { + ID func(childComplexity int) int + Properties func(childComplexity int) int + UpdatedOn func(childComplexity int) int + UserUID func(childComplexity int) int + } +} + +type MutationResolver interface { + UpdateUserSessions(ctx context.Context, currentSession string, sessionType model.ReqType) (*model.User, error) + DeleteUser(ctx context.Context) (bool, error) + UpdateInfraConfigs(ctx context.Context, infraConfigs []*dto.InfraConfigArgs) ([]*model.InfraConfig, error) + ResetInfraConfigs(ctx context.Context) (bool, error) + EnableAndDisableSso(ctx context.Context, providerInfo []*dto.EnableAndDisableSSOArgs) (bool, error) + InviteNewUser(ctx context.Context, inviteeEmail string) (*model.InvitedUser, error) + RemoveUserByAdmin(ctx context.Context, userUID string) (bool, error) + MakeUserAdmin(ctx context.Context, userUID string) (bool, error) + RemoveUserAsAdmin(ctx context.Context, userUID string) (bool, error) + CreateTeamByAdmin(ctx context.Context, userUID string, name string) (*model.Team, error) + ChangeUserRoleInTeamByAdmin(ctx context.Context, userUID string, teamID string, newRole model.TeamMemberRole) (*model.TeamMember, error) + RemoveUserFromTeamByAdmin(ctx context.Context, userUID string, teamID string) (bool, error) + AddUserToTeamByAdmin(ctx context.Context, teamID string, role model.TeamMemberRole, userEmail string) (*model.TeamMember, error) + RenameTeamByAdmin(ctx context.Context, teamID string, newName string) (*model.Team, error) + DeleteTeamByAdmin(ctx context.Context, teamID string) (bool, error) + RevokeTeamInviteByAdmin(ctx context.Context, inviteID string) (bool, error) + RevokeShortcodeByAdmin(ctx context.Context, code string) (bool, error) + CreateTeam(ctx context.Context, name string) (*model.Team, error) + LeaveTeam(ctx context.Context, teamID string) (bool, error) + RemoveTeamMember(ctx context.Context, teamID string, userUID string) (bool, error) + RenameTeam(ctx context.Context, teamID string, newName string) (*model.Team, error) + DeleteTeam(ctx context.Context, teamID string) (bool, error) + UpdateTeamMemberRole(ctx context.Context, teamID string, userUID string, newRole model.TeamMemberRole) (*model.TeamMember, error) + CreateTeamInvitation(ctx context.Context, teamID string, inviteeEmail string, inviteeRole model.TeamMemberRole) (*model.TeamInvitation, error) + RevokeTeamInvitation(ctx context.Context, inviteID string) (bool, error) + AcceptTeamInvitation(ctx context.Context, inviteID string) (*model.TeamMember, error) + CreateTeamEnvironment(ctx context.Context, name string, teamID string, variables string) (*model.TeamEnvironment, error) + DeleteTeamEnvironment(ctx context.Context, id string) (bool, error) + UpdateTeamEnvironment(ctx context.Context, id string, name string, variables string) (*model.TeamEnvironment, error) + DeleteAllVariablesFromTeamEnvironment(ctx context.Context, id string) (*model.TeamEnvironment, error) + CreateDuplicateEnvironment(ctx context.Context, id string) (*model.TeamEnvironment, error) + CreateRootCollection(ctx context.Context, teamID string, title string, data *string) (*model.TeamCollection, error) + ImportCollectionsFromJSON(ctx context.Context, teamID string, jsonString string, parentCollectionID *string) (bool, error) + ReplaceCollectionsWithJSON(ctx context.Context, teamID string, jsonString string, parentCollectionID *string) (bool, error) + CreateChildCollection(ctx context.Context, collectionID string, childTitle string, data *string) (*model.TeamCollection, error) + RenameCollection(ctx context.Context, collectionID string, newTitle string) (*model.TeamCollection, error) + DeleteCollection(ctx context.Context, collectionID string) (bool, error) + MoveCollection(ctx context.Context, parentCollectionID *string, collectionID string) (*model.TeamCollection, error) + UpdateCollectionOrder(ctx context.Context, collectionID string, destCollID *string) (bool, error) + UpdateTeamCollection(ctx context.Context, collectionID string, newTitle *string, data *string) (*model.TeamCollection, error) + CreateRequestInCollection(ctx context.Context, collectionID string, data dto.CreateTeamRequestInput) (*model.TeamRequest, error) + UpdateRequest(ctx context.Context, requestID string, data dto.UpdateTeamRequestInput) (*model.TeamRequest, error) + DeleteRequest(ctx context.Context, requestID string) (bool, error) + UpdateLookUpRequestOrder(ctx context.Context, collectionID string, nextRequestID *string, requestID string) (bool, error) + MoveRequest(ctx context.Context, srcCollID *string, requestID string, destCollID string, nextRequestID *string) (*model.TeamRequest, error) + CreateShortcode(ctx context.Context, request string, properties *string) (*model.Shortcode, error) + UpdateEmbedProperties(ctx context.Context, code string, properties string) (*model.Shortcode, error) + RevokeShortcode(ctx context.Context, code string) (bool, error) + CreateUserSettings(ctx context.Context, properties string) (*model.UserSetting, error) + UpdateUserSettings(ctx context.Context, properties string) (*model.UserSetting, error) + CreateUserEnvironment(ctx context.Context, name string, variables string) (*model.UserEnvironment, error) + CreateUserGlobalEnvironment(ctx context.Context, variables string) (*model.UserEnvironment, error) + UpdateUserEnvironment(ctx context.Context, id string, name string, variables string) (*model.UserEnvironment, error) + DeleteUserEnvironment(ctx context.Context, id string) (bool, error) + DeleteUserEnvironments(ctx context.Context) (int, error) + ClearGlobalEnvironments(ctx context.Context, id string) (*model.UserEnvironment, error) + CreateUserHistory(ctx context.Context, reqData string, resMetadata string, reqType model.ReqType) (*model.UserHistory, error) + ToggleHistoryStarStatus(ctx context.Context, id string) (*model.UserHistory, error) + RemoveRequestFromHistory(ctx context.Context, id string) (*model.UserHistory, error) + DeleteAllUserHistory(ctx context.Context, reqType model.ReqType) (*dto.UserHistoryDeletedManyData, error) + CreateRESTUserRequest(ctx context.Context, collectionID string, title string, request string) (*model.UserRequest, error) + CreateGQLUserRequest(ctx context.Context, collectionID string, title string, request string) (*model.UserRequest, error) + UpdateRESTUserRequest(ctx context.Context, id string, title *string, request *string) (*model.UserRequest, error) + UpdateGQLUserRequest(ctx context.Context, id string, title *string, request *string) (*model.UserRequest, error) + DeleteUserRequest(ctx context.Context, id string) (bool, error) + MoveUserRequest(ctx context.Context, sourceCollectionID string, requestID string, destinationCollectionID string, nextRequestID *string) (*model.UserRequest, error) + CreateRESTRootUserCollection(ctx context.Context, title string, data *string) (*model.UserCollection, error) + CreateGQLRootUserCollection(ctx context.Context, title string, data *string) (*model.UserCollection, error) + CreateGQLChildUserCollection(ctx context.Context, title string, parentUserCollectionID string, data *string) (*model.UserCollection, error) + CreateRESTChildUserCollection(ctx context.Context, title string, parentUserCollectionID string, data *string) (*model.UserCollection, error) + RenameUserCollection(ctx context.Context, userCollectionID string, newTitle string) (*model.UserCollection, error) + DeleteUserCollection(ctx context.Context, userCollectionID string) (bool, error) + MoveUserCollection(ctx context.Context, destCollectionID *string, userCollectionID string) (*model.UserCollection, error) + UpdateUserCollectionOrder(ctx context.Context, collectionID string, nextCollectionID *string) (bool, error) + ImportUserCollectionsFromJSON(ctx context.Context, jsonString string, reqType model.ReqType, parentCollectionID *string) (bool, error) + UpdateUserCollection(ctx context.Context, userCollectionID string, newTitle *string, data *string) (*model.UserCollection, error) +} +type QueryResolver interface { + Me(ctx context.Context) (*model.User, error) + Infra(ctx context.Context) (*dto.Infra, error) + InfraConfigs(ctx context.Context, configNames []dto.InfraConfigEnum) ([]*model.InfraConfig, error) + AllowedAuthProviders(ctx context.Context) ([]string, error) + Admin(ctx context.Context) (*dto.Admin, error) + MyTeams(ctx context.Context, cursor *string) ([]*model.Team, error) + Team(ctx context.Context, teamID string) (*model.Team, error) + TeamInvitation(ctx context.Context, inviteID string) (*model.TeamInvitation, error) + ExportCollectionsToJSON(ctx context.Context, teamID string) (string, error) + RootCollectionsOfTeam(ctx context.Context, cursor *string, take *int, teamID string) ([]*model.TeamCollection, error) + Collection(ctx context.Context, collectionID string) (*model.TeamCollection, error) + SearchForRequest(ctx context.Context, cursor *string, take *int, teamID string, searchTerm string) ([]*model.TeamRequest, error) + Request(ctx context.Context, requestID string) (*model.TeamRequest, error) + RequestsInCollection(ctx context.Context, cursor *string, take *int, collectionID string) ([]*model.TeamRequest, error) + Shortcode(ctx context.Context, code string) (*model.Shortcode, error) + MyShortcodes(ctx context.Context, cursor *string, take *int) ([]*model.Shortcode, error) + UserRESTRequests(ctx context.Context, cursor *string, take *int, collectionID *string) ([]*model.UserRequest, error) + UserGQLRequests(ctx context.Context, cursor *string, take *int, collectionID *string) ([]*model.UserRequest, error) + UserRequest(ctx context.Context, id string) (*model.UserRequest, error) + RootRESTUserCollections(ctx context.Context, cursor *string, take *int) ([]*model.UserCollection, error) + RootGQLUserCollections(ctx context.Context, cursor *string, take *int) ([]*model.UserCollection, error) + UserCollection(ctx context.Context, userCollectionID string) (*model.UserCollection, error) + ExportUserCollectionsToJSON(ctx context.Context, collectionID *string, collectionType model.ReqType) (*dto.UserCollectionExportJSONData, error) +} +type SubscriptionResolver interface { + UserUpdated(ctx context.Context) (<-chan *model.User, error) + UserDeleted(ctx context.Context) (<-chan *model.User, error) + UserInvited(ctx context.Context) (<-chan *model.InvitedUser, error) + TeamMemberAdded(ctx context.Context, teamID string) (<-chan *model.TeamMember, error) + TeamMemberUpdated(ctx context.Context, teamID string) (<-chan *model.TeamMember, error) + TeamMemberRemoved(ctx context.Context, teamID string) (<-chan string, error) + TeamInvitationAdded(ctx context.Context, teamID string) (<-chan *model.TeamInvitation, error) + TeamInvitationRemoved(ctx context.Context, teamID string) (<-chan string, error) + TeamEnvironmentUpdated(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) + TeamEnvironmentCreated(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) + TeamEnvironmentDeleted(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) + TeamCollectionAdded(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) + TeamCollectionUpdated(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) + TeamCollectionRemoved(ctx context.Context, teamID string) (<-chan string, error) + TeamCollectionMoved(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) + CollectionOrderUpdated(ctx context.Context, teamID string) (<-chan *dto.CollectionReorderData, error) + TeamRequestAdded(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) + TeamRequestUpdated(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) + TeamRequestDeleted(ctx context.Context, teamID string) (<-chan string, error) + RequestOrderUpdated(ctx context.Context, teamID string) (<-chan *dto.RequestReorderData, error) + RequestMoved(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) + MyShortcodesCreated(ctx context.Context) (<-chan *model.Shortcode, error) + MyShortcodesUpdated(ctx context.Context) (<-chan *model.Shortcode, error) + MyShortcodesRevoked(ctx context.Context) (<-chan *model.Shortcode, error) + UserSettingsCreated(ctx context.Context) (<-chan *model.UserSetting, error) + UserSettingsUpdated(ctx context.Context) (<-chan *model.UserSetting, error) + UserEnvironmentCreated(ctx context.Context) (<-chan *model.UserEnvironment, error) + UserEnvironmentUpdated(ctx context.Context) (<-chan *model.UserEnvironment, error) + UserEnvironmentDeleted(ctx context.Context) (<-chan *model.UserEnvironment, error) + UserEnvironmentDeleteMany(ctx context.Context) (<-chan int, error) + UserHistoryCreated(ctx context.Context) (<-chan *model.UserHistory, error) + UserHistoryUpdated(ctx context.Context) (<-chan *model.UserHistory, error) + UserHistoryDeleted(ctx context.Context) (<-chan *model.UserHistory, error) + UserHistoryDeletedMany(ctx context.Context) (<-chan *dto.UserHistoryDeletedManyData, error) + UserRequestCreated(ctx context.Context) (<-chan *model.UserRequest, error) + UserRequestUpdated(ctx context.Context) (<-chan *model.UserRequest, error) + UserRequestDeleted(ctx context.Context) (<-chan *model.UserRequest, error) + UserRequestMoved(ctx context.Context) (<-chan *dto.UserRequestReorderData, error) + UserCollectionCreated(ctx context.Context) (<-chan *model.UserCollection, error) + UserCollectionUpdated(ctx context.Context) (<-chan *model.UserCollection, error) + UserCollectionRemoved(ctx context.Context) (<-chan *dto.UserCollectionRemovedData, error) + UserCollectionMoved(ctx context.Context) (<-chan *model.UserCollection, error) + UserCollectionOrderUpdated(ctx context.Context) (<-chan *dto.UserCollectionReorderData, error) +} +type TeamResolver interface { + TeamMembers(ctx context.Context, obj *model.Team) ([]*model.TeamMember, error) + MyRole(ctx context.Context, obj *model.Team) (*model.TeamMemberRole, error) + OwnersCount(ctx context.Context, obj *model.Team) (int64, error) + EditorsCount(ctx context.Context, obj *model.Team) (int64, error) + ViewersCount(ctx context.Context, obj *model.Team) (int64, error) + TeamInvitations(ctx context.Context, obj *model.Team) ([]*model.TeamInvitation, error) + TeamEnvironments(ctx context.Context, obj *model.Team) ([]*model.TeamEnvironment, error) +} +type UserResolver interface { + GlobalEnvironments(ctx context.Context, obj *model.User) (*model.UserEnvironment, error) + RESTHistory(ctx context.Context, obj *model.User, cursor *string, take *int) ([]*model.UserHistory, error) + GQLHistory(ctx context.Context, obj *model.User, cursor *string, take *int) ([]*model.UserHistory, error) +} +type UserCollectionResolver interface { + ChildrenRest(ctx context.Context, obj *model.UserCollection, cursor *string, take *int) ([]*model.UserCollection, error) + ChildrenGql(ctx context.Context, obj *model.UserCollection, cursor *string, take *int) ([]*model.UserCollection, error) +} + +type executableSchema struct { + schema *ast.Schema + resolvers ResolverRoot + directives DirectiveRoot + complexity ComplexityRoot +} + +func (e *executableSchema) Schema() *ast.Schema { + if e.schema != nil { + return e.schema + } + return parsedSchema +} + +func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { + ec := executionContext{nil, e, 0, 0, nil} + _ = ec + switch typeName + "." + field { + + case "Admin.admins": + if e.complexity.Admin.Admins == nil { + break + } + + return e.complexity.Admin.Admins(childComplexity), true + + case "Admin.allTeams": + if e.complexity.Admin.AllTeams == nil { + break + } + + args, err := ec.field_Admin_allTeams_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.AllTeams(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Admin.allUsers": + if e.complexity.Admin.AllUsers == nil { + break + } + + args, err := ec.field_Admin_allUsers_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.AllUsers(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Admin.collectionCountInTeam": + if e.complexity.Admin.CollectionCountInTeam == nil { + break + } + + args, err := ec.field_Admin_collectionCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.CollectionCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Admin.createdOn": + if e.complexity.Admin.CreatedOn == nil { + break + } + + return e.complexity.Admin.CreatedOn(childComplexity), true + + case "Admin.displayName": + if e.complexity.Admin.DisplayName == nil { + break + } + + return e.complexity.Admin.DisplayName(childComplexity), true + + case "Admin.email": + if e.complexity.Admin.Email == nil { + break + } + + return e.complexity.Admin.Email(childComplexity), true + + case "Admin.environmentCountInTeam": + if e.complexity.Admin.EnvironmentCountInTeam == nil { + break + } + + args, err := ec.field_Admin_environmentCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.EnvironmentCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Admin.invitedUsers": + if e.complexity.Admin.InvitedUsers == nil { + break + } + + return e.complexity.Admin.InvitedUsers(childComplexity), true + + case "Admin.membersCountInTeam": + if e.complexity.Admin.MembersCountInTeam == nil { + break + } + + args, err := ec.field_Admin_membersCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.MembersCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Admin.pendingInvitationCountInTeam": + if e.complexity.Admin.PendingInvitationCountInTeam == nil { + break + } + + args, err := ec.field_Admin_pendingInvitationCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.PendingInvitationCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Admin.photoURL": + if e.complexity.Admin.PhotoURL == nil { + break + } + + return e.complexity.Admin.PhotoURL(childComplexity), true + + case "Admin.requestCountInTeam": + if e.complexity.Admin.RequestCountInTeam == nil { + break + } + + args, err := ec.field_Admin_requestCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.RequestCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Admin.teamCollectionsCount": + if e.complexity.Admin.TeamCollectionsCount == nil { + break + } + + return e.complexity.Admin.TeamCollectionsCount(childComplexity), true + + case "Admin.teamInfo": + if e.complexity.Admin.TeamInfo == nil { + break + } + + args, err := ec.field_Admin_teamInfo_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.TeamInfo(childComplexity, args["teamID"].(string)), true + + case "Admin.teamRequestsCount": + if e.complexity.Admin.TeamRequestsCount == nil { + break + } + + return e.complexity.Admin.TeamRequestsCount(childComplexity), true + + case "Admin.teamsCount": + if e.complexity.Admin.TeamsCount == nil { + break + } + + return e.complexity.Admin.TeamsCount(childComplexity), true + + case "Admin.uid": + if e.complexity.Admin.UID == nil { + break + } + + return e.complexity.Admin.UID(childComplexity), true + + case "Admin.userInfo": + if e.complexity.Admin.UserInfo == nil { + break + } + + args, err := ec.field_Admin_userInfo_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Admin.UserInfo(childComplexity, args["userUid"].(string)), true + + case "Admin.usersCount": + if e.complexity.Admin.UsersCount == nil { + break + } + + return e.complexity.Admin.UsersCount(childComplexity), true + + case "CollectionReorderData.collection": + if e.complexity.CollectionReorderData.Collection == nil { + break + } + + return e.complexity.CollectionReorderData.Collection(childComplexity), true + + case "CollectionReorderData.nextCollection": + if e.complexity.CollectionReorderData.NextCollection == nil { + break + } + + return e.complexity.CollectionReorderData.NextCollection(childComplexity), true + + case "Infra.admins": + if e.complexity.Infra.Admins == nil { + break + } + + return e.complexity.Infra.Admins(childComplexity), true + + case "Infra.allShortcodes": + if e.complexity.Infra.AllShortcodes == nil { + break + } + + args, err := ec.field_Infra_allShortcodes_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.AllShortcodes(childComplexity, args["cursor"].(*string), args["take"].(*int), args["userEmail"].(*string)), true + + case "Infra.allTeams": + if e.complexity.Infra.AllTeams == nil { + break + } + + args, err := ec.field_Infra_allTeams_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.AllTeams(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Infra.allUsers": + if e.complexity.Infra.AllUsers == nil { + break + } + + args, err := ec.field_Infra_allUsers_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.AllUsers(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Infra.collectionCountInTeam": + if e.complexity.Infra.CollectionCountInTeam == nil { + break + } + + args, err := ec.field_Infra_collectionCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.CollectionCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Infra.environmentCountInTeam": + if e.complexity.Infra.EnvironmentCountInTeam == nil { + break + } + + args, err := ec.field_Infra_environmentCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.EnvironmentCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Infra.executedBy": + if e.complexity.Infra.ExecutedBy == nil { + break + } + + return e.complexity.Infra.ExecutedBy(childComplexity), true + + case "Infra.invitedUsers": + if e.complexity.Infra.InvitedUsers == nil { + break + } + + return e.complexity.Infra.InvitedUsers(childComplexity), true + + case "Infra.membersCountInTeam": + if e.complexity.Infra.MembersCountInTeam == nil { + break + } + + args, err := ec.field_Infra_membersCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.MembersCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Infra.pendingInvitationCountInTeam": + if e.complexity.Infra.PendingInvitationCountInTeam == nil { + break + } + + args, err := ec.field_Infra_pendingInvitationCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.PendingInvitationCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Infra.requestCountInTeam": + if e.complexity.Infra.RequestCountInTeam == nil { + break + } + + args, err := ec.field_Infra_requestCountInTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.RequestCountInTeam(childComplexity, args["teamID"].(string)), true + + case "Infra.teamCollectionsCount": + if e.complexity.Infra.TeamCollectionsCount == nil { + break + } + + return e.complexity.Infra.TeamCollectionsCount(childComplexity), true + + case "Infra.teamInfo": + if e.complexity.Infra.TeamInfo == nil { + break + } + + args, err := ec.field_Infra_teamInfo_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.TeamInfo(childComplexity, args["teamID"].(string)), true + + case "Infra.teamRequestsCount": + if e.complexity.Infra.TeamRequestsCount == nil { + break + } + + return e.complexity.Infra.TeamRequestsCount(childComplexity), true + + case "Infra.teamsCount": + if e.complexity.Infra.TeamsCount == nil { + break + } + + return e.complexity.Infra.TeamsCount(childComplexity), true + + case "Infra.userInfo": + if e.complexity.Infra.UserInfo == nil { + break + } + + args, err := ec.field_Infra_userInfo_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Infra.UserInfo(childComplexity, args["userUid"].(string)), true + + case "Infra.usersCount": + if e.complexity.Infra.UsersCount == nil { + break + } + + return e.complexity.Infra.UsersCount(childComplexity), true + + case "InfraConfig.name": + if e.complexity.InfraConfig.Name == nil { + break + } + + return e.complexity.InfraConfig.Name(childComplexity), true + + case "InfraConfig.value": + if e.complexity.InfraConfig.Value == nil { + break + } + + return e.complexity.InfraConfig.Value(childComplexity), true + + case "InvitedUser.adminEmail": + if e.complexity.InvitedUser.AdminEmail == nil { + break + } + + return e.complexity.InvitedUser.AdminEmail(childComplexity), true + + case "InvitedUser.adminUid": + if e.complexity.InvitedUser.AdminUID == nil { + break + } + + return e.complexity.InvitedUser.AdminUID(childComplexity), true + + case "InvitedUser.invitedOn": + if e.complexity.InvitedUser.InvitedOn == nil { + break + } + + return e.complexity.InvitedUser.InvitedOn(childComplexity), true + + case "InvitedUser.inviteeEmail": + if e.complexity.InvitedUser.InviteeEmail == nil { + break + } + + return e.complexity.InvitedUser.InviteeEmail(childComplexity), true + + case "Mutation.acceptTeamInvitation": + if e.complexity.Mutation.AcceptTeamInvitation == nil { + break + } + + args, err := ec.field_Mutation_acceptTeamInvitation_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.AcceptTeamInvitation(childComplexity, args["inviteID"].(string)), true + + case "Mutation.addUserToTeamByAdmin": + if e.complexity.Mutation.AddUserToTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_addUserToTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.AddUserToTeamByAdmin(childComplexity, args["teamID"].(string), args["role"].(model.TeamMemberRole), args["userEmail"].(string)), true + + case "Mutation.changeUserRoleInTeamByAdmin": + if e.complexity.Mutation.ChangeUserRoleInTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_changeUserRoleInTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ChangeUserRoleInTeamByAdmin(childComplexity, args["userUID"].(string), args["teamID"].(string), args["newRole"].(model.TeamMemberRole)), true + + case "Mutation.clearGlobalEnvironments": + if e.complexity.Mutation.ClearGlobalEnvironments == nil { + break + } + + args, err := ec.field_Mutation_clearGlobalEnvironments_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ClearGlobalEnvironments(childComplexity, args["id"].(string)), true + + case "Mutation.createChildCollection": + if e.complexity.Mutation.CreateChildCollection == nil { + break + } + + args, err := ec.field_Mutation_createChildCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateChildCollection(childComplexity, args["collectionID"].(string), args["childTitle"].(string), args["data"].(*string)), true + + case "Mutation.createDuplicateEnvironment": + if e.complexity.Mutation.CreateDuplicateEnvironment == nil { + break + } + + args, err := ec.field_Mutation_createDuplicateEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateDuplicateEnvironment(childComplexity, args["id"].(string)), true + + case "Mutation.createGQLChildUserCollection": + if e.complexity.Mutation.CreateGQLChildUserCollection == nil { + break + } + + args, err := ec.field_Mutation_createGQLChildUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateGQLChildUserCollection(childComplexity, args["title"].(string), args["parentUserCollectionID"].(string), args["data"].(*string)), true + + case "Mutation.createGQLRootUserCollection": + if e.complexity.Mutation.CreateGQLRootUserCollection == nil { + break + } + + args, err := ec.field_Mutation_createGQLRootUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateGQLRootUserCollection(childComplexity, args["title"].(string), args["data"].(*string)), true + + case "Mutation.createGQLUserRequest": + if e.complexity.Mutation.CreateGQLUserRequest == nil { + break + } + + args, err := ec.field_Mutation_createGQLUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateGQLUserRequest(childComplexity, args["collectionID"].(string), args["title"].(string), args["request"].(string)), true + + case "Mutation.createRESTChildUserCollection": + if e.complexity.Mutation.CreateRESTChildUserCollection == nil { + break + } + + args, err := ec.field_Mutation_createRESTChildUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRESTChildUserCollection(childComplexity, args["title"].(string), args["parentUserCollectionID"].(string), args["data"].(*string)), true + + case "Mutation.createRESTRootUserCollection": + if e.complexity.Mutation.CreateRESTRootUserCollection == nil { + break + } + + args, err := ec.field_Mutation_createRESTRootUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRESTRootUserCollection(childComplexity, args["title"].(string), args["data"].(*string)), true + + case "Mutation.createRESTUserRequest": + if e.complexity.Mutation.CreateRESTUserRequest == nil { + break + } + + args, err := ec.field_Mutation_createRESTUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRESTUserRequest(childComplexity, args["collectionID"].(string), args["title"].(string), args["request"].(string)), true + + case "Mutation.createRequestInCollection": + if e.complexity.Mutation.CreateRequestInCollection == nil { + break + } + + args, err := ec.field_Mutation_createRequestInCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRequestInCollection(childComplexity, args["collectionID"].(string), args["data"].(dto.CreateTeamRequestInput)), true + + case "Mutation.createRootCollection": + if e.complexity.Mutation.CreateRootCollection == nil { + break + } + + args, err := ec.field_Mutation_createRootCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateRootCollection(childComplexity, args["teamID"].(string), args["title"].(string), args["data"].(*string)), true + + case "Mutation.createShortcode": + if e.complexity.Mutation.CreateShortcode == nil { + break + } + + args, err := ec.field_Mutation_createShortcode_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateShortcode(childComplexity, args["request"].(string), args["properties"].(*string)), true + + case "Mutation.createTeam": + if e.complexity.Mutation.CreateTeam == nil { + break + } + + args, err := ec.field_Mutation_createTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateTeam(childComplexity, args["name"].(string)), true + + case "Mutation.createTeamByAdmin": + if e.complexity.Mutation.CreateTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_createTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateTeamByAdmin(childComplexity, args["userUid"].(string), args["name"].(string)), true + + case "Mutation.createTeamEnvironment": + if e.complexity.Mutation.CreateTeamEnvironment == nil { + break + } + + args, err := ec.field_Mutation_createTeamEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateTeamEnvironment(childComplexity, args["name"].(string), args["teamID"].(string), args["variables"].(string)), true + + case "Mutation.createTeamInvitation": + if e.complexity.Mutation.CreateTeamInvitation == nil { + break + } + + args, err := ec.field_Mutation_createTeamInvitation_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateTeamInvitation(childComplexity, args["teamID"].(string), args["inviteeEmail"].(string), args["inviteeRole"].(model.TeamMemberRole)), true + + case "Mutation.createUserEnvironment": + if e.complexity.Mutation.CreateUserEnvironment == nil { + break + } + + args, err := ec.field_Mutation_createUserEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateUserEnvironment(childComplexity, args["name"].(string), args["variables"].(string)), true + + case "Mutation.createUserGlobalEnvironment": + if e.complexity.Mutation.CreateUserGlobalEnvironment == nil { + break + } + + args, err := ec.field_Mutation_createUserGlobalEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateUserGlobalEnvironment(childComplexity, args["variables"].(string)), true + + case "Mutation.createUserHistory": + if e.complexity.Mutation.CreateUserHistory == nil { + break + } + + args, err := ec.field_Mutation_createUserHistory_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateUserHistory(childComplexity, args["reqData"].(string), args["resMetadata"].(string), args["reqType"].(model.ReqType)), true + + case "Mutation.createUserSettings": + if e.complexity.Mutation.CreateUserSettings == nil { + break + } + + args, err := ec.field_Mutation_createUserSettings_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateUserSettings(childComplexity, args["properties"].(string)), true + + case "Mutation.deleteAllUserHistory": + if e.complexity.Mutation.DeleteAllUserHistory == nil { + break + } + + args, err := ec.field_Mutation_deleteAllUserHistory_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteAllUserHistory(childComplexity, args["reqType"].(model.ReqType)), true + + case "Mutation.deleteAllVariablesFromTeamEnvironment": + if e.complexity.Mutation.DeleteAllVariablesFromTeamEnvironment == nil { + break + } + + args, err := ec.field_Mutation_deleteAllVariablesFromTeamEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteAllVariablesFromTeamEnvironment(childComplexity, args["id"].(string)), true + + case "Mutation.deleteCollection": + if e.complexity.Mutation.DeleteCollection == nil { + break + } + + args, err := ec.field_Mutation_deleteCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteCollection(childComplexity, args["collectionID"].(string)), true + + case "Mutation.deleteRequest": + if e.complexity.Mutation.DeleteRequest == nil { + break + } + + args, err := ec.field_Mutation_deleteRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteRequest(childComplexity, args["requestID"].(string)), true + + case "Mutation.deleteTeam": + if e.complexity.Mutation.DeleteTeam == nil { + break + } + + args, err := ec.field_Mutation_deleteTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteTeam(childComplexity, args["teamID"].(string)), true + + case "Mutation.deleteTeamByAdmin": + if e.complexity.Mutation.DeleteTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_deleteTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteTeamByAdmin(childComplexity, args["teamID"].(string)), true + + case "Mutation.deleteTeamEnvironment": + if e.complexity.Mutation.DeleteTeamEnvironment == nil { + break + } + + args, err := ec.field_Mutation_deleteTeamEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteTeamEnvironment(childComplexity, args["id"].(string)), true + + case "Mutation.deleteUser": + if e.complexity.Mutation.DeleteUser == nil { + break + } + + return e.complexity.Mutation.DeleteUser(childComplexity), true + + case "Mutation.deleteUserCollection": + if e.complexity.Mutation.DeleteUserCollection == nil { + break + } + + args, err := ec.field_Mutation_deleteUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteUserCollection(childComplexity, args["userCollectionID"].(string)), true + + case "Mutation.deleteUserEnvironment": + if e.complexity.Mutation.DeleteUserEnvironment == nil { + break + } + + args, err := ec.field_Mutation_deleteUserEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteUserEnvironment(childComplexity, args["id"].(string)), true + + case "Mutation.deleteUserEnvironments": + if e.complexity.Mutation.DeleteUserEnvironments == nil { + break + } + + return e.complexity.Mutation.DeleteUserEnvironments(childComplexity), true + + case "Mutation.deleteUserRequest": + if e.complexity.Mutation.DeleteUserRequest == nil { + break + } + + args, err := ec.field_Mutation_deleteUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteUserRequest(childComplexity, args["id"].(string)), true + + case "Mutation.enableAndDisableSSO": + if e.complexity.Mutation.EnableAndDisableSso == nil { + break + } + + args, err := ec.field_Mutation_enableAndDisableSSO_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.EnableAndDisableSso(childComplexity, args["providerInfo"].([]*dto.EnableAndDisableSSOArgs)), true + + case "Mutation.importCollectionsFromJSON": + if e.complexity.Mutation.ImportCollectionsFromJSON == nil { + break + } + + args, err := ec.field_Mutation_importCollectionsFromJSON_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ImportCollectionsFromJSON(childComplexity, args["teamID"].(string), args["jsonString"].(string), args["parentCollectionID"].(*string)), true + + case "Mutation.importUserCollectionsFromJSON": + if e.complexity.Mutation.ImportUserCollectionsFromJSON == nil { + break + } + + args, err := ec.field_Mutation_importUserCollectionsFromJSON_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ImportUserCollectionsFromJSON(childComplexity, args["jsonString"].(string), args["reqType"].(model.ReqType), args["parentCollectionID"].(*string)), true + + case "Mutation.inviteNewUser": + if e.complexity.Mutation.InviteNewUser == nil { + break + } + + args, err := ec.field_Mutation_inviteNewUser_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.InviteNewUser(childComplexity, args["inviteeEmail"].(string)), true + + case "Mutation.leaveTeam": + if e.complexity.Mutation.LeaveTeam == nil { + break + } + + args, err := ec.field_Mutation_leaveTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.LeaveTeam(childComplexity, args["teamID"].(string)), true + + case "Mutation.makeUserAdmin": + if e.complexity.Mutation.MakeUserAdmin == nil { + break + } + + args, err := ec.field_Mutation_makeUserAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MakeUserAdmin(childComplexity, args["userUID"].(string)), true + + case "Mutation.moveCollection": + if e.complexity.Mutation.MoveCollection == nil { + break + } + + args, err := ec.field_Mutation_moveCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MoveCollection(childComplexity, args["parentCollectionID"].(*string), args["collectionID"].(string)), true + + case "Mutation.moveRequest": + if e.complexity.Mutation.MoveRequest == nil { + break + } + + args, err := ec.field_Mutation_moveRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MoveRequest(childComplexity, args["srcCollID"].(*string), args["requestID"].(string), args["destCollID"].(string), args["nextRequestID"].(*string)), true + + case "Mutation.moveUserCollection": + if e.complexity.Mutation.MoveUserCollection == nil { + break + } + + args, err := ec.field_Mutation_moveUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MoveUserCollection(childComplexity, args["destCollectionID"].(*string), args["userCollectionID"].(string)), true + + case "Mutation.moveUserRequest": + if e.complexity.Mutation.MoveUserRequest == nil { + break + } + + args, err := ec.field_Mutation_moveUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MoveUserRequest(childComplexity, args["sourceCollectionID"].(string), args["requestID"].(string), args["destinationCollectionID"].(string), args["nextRequestID"].(*string)), true + + case "Mutation.removeRequestFromHistory": + if e.complexity.Mutation.RemoveRequestFromHistory == nil { + break + } + + args, err := ec.field_Mutation_removeRequestFromHistory_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveRequestFromHistory(childComplexity, args["id"].(string)), true + + case "Mutation.removeTeamMember": + if e.complexity.Mutation.RemoveTeamMember == nil { + break + } + + args, err := ec.field_Mutation_removeTeamMember_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveTeamMember(childComplexity, args["teamID"].(string), args["userUid"].(string)), true + + case "Mutation.removeUserAsAdmin": + if e.complexity.Mutation.RemoveUserAsAdmin == nil { + break + } + + args, err := ec.field_Mutation_removeUserAsAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveUserAsAdmin(childComplexity, args["userUID"].(string)), true + + case "Mutation.removeUserByAdmin": + if e.complexity.Mutation.RemoveUserByAdmin == nil { + break + } + + args, err := ec.field_Mutation_removeUserByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveUserByAdmin(childComplexity, args["userUID"].(string)), true + + case "Mutation.removeUserFromTeamByAdmin": + if e.complexity.Mutation.RemoveUserFromTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_removeUserFromTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveUserFromTeamByAdmin(childComplexity, args["userUid"].(string), args["teamID"].(string)), true + + case "Mutation.renameCollection": + if e.complexity.Mutation.RenameCollection == nil { + break + } + + args, err := ec.field_Mutation_renameCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RenameCollection(childComplexity, args["collectionID"].(string), args["newTitle"].(string)), true + + case "Mutation.renameTeam": + if e.complexity.Mutation.RenameTeam == nil { + break + } + + args, err := ec.field_Mutation_renameTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RenameTeam(childComplexity, args["teamID"].(string), args["newName"].(string)), true + + case "Mutation.renameTeamByAdmin": + if e.complexity.Mutation.RenameTeamByAdmin == nil { + break + } + + args, err := ec.field_Mutation_renameTeamByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RenameTeamByAdmin(childComplexity, args["teamID"].(string), args["newName"].(string)), true + + case "Mutation.renameUserCollection": + if e.complexity.Mutation.RenameUserCollection == nil { + break + } + + args, err := ec.field_Mutation_renameUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RenameUserCollection(childComplexity, args["userCollectionID"].(string), args["newTitle"].(string)), true + + case "Mutation.replaceCollectionsWithJSON": + if e.complexity.Mutation.ReplaceCollectionsWithJSON == nil { + break + } + + args, err := ec.field_Mutation_replaceCollectionsWithJSON_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ReplaceCollectionsWithJSON(childComplexity, args["teamID"].(string), args["jsonString"].(string), args["parentCollectionID"].(*string)), true + + case "Mutation.resetInfraConfigs": + if e.complexity.Mutation.ResetInfraConfigs == nil { + break + } + + return e.complexity.Mutation.ResetInfraConfigs(childComplexity), true + + case "Mutation.revokeShortcode": + if e.complexity.Mutation.RevokeShortcode == nil { + break + } + + args, err := ec.field_Mutation_revokeShortcode_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RevokeShortcode(childComplexity, args["code"].(string)), true + + case "Mutation.revokeShortcodeByAdmin": + if e.complexity.Mutation.RevokeShortcodeByAdmin == nil { + break + } + + args, err := ec.field_Mutation_revokeShortcodeByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RevokeShortcodeByAdmin(childComplexity, args["code"].(string)), true + + case "Mutation.revokeTeamInvitation": + if e.complexity.Mutation.RevokeTeamInvitation == nil { + break + } + + args, err := ec.field_Mutation_revokeTeamInvitation_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RevokeTeamInvitation(childComplexity, args["inviteID"].(string)), true + + case "Mutation.revokeTeamInviteByAdmin": + if e.complexity.Mutation.RevokeTeamInviteByAdmin == nil { + break + } + + args, err := ec.field_Mutation_revokeTeamInviteByAdmin_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RevokeTeamInviteByAdmin(childComplexity, args["inviteID"].(string)), true + + case "Mutation.toggleHistoryStarStatus": + if e.complexity.Mutation.ToggleHistoryStarStatus == nil { + break + } + + args, err := ec.field_Mutation_toggleHistoryStarStatus_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.ToggleHistoryStarStatus(childComplexity, args["id"].(string)), true + + case "Mutation.updateCollectionOrder": + if e.complexity.Mutation.UpdateCollectionOrder == nil { + break + } + + args, err := ec.field_Mutation_updateCollectionOrder_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateCollectionOrder(childComplexity, args["collectionID"].(string), args["destCollID"].(*string)), true + + case "Mutation.updateEmbedProperties": + if e.complexity.Mutation.UpdateEmbedProperties == nil { + break + } + + args, err := ec.field_Mutation_updateEmbedProperties_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateEmbedProperties(childComplexity, args["code"].(string), args["properties"].(string)), true + + case "Mutation.updateGQLUserRequest": + if e.complexity.Mutation.UpdateGQLUserRequest == nil { + break + } + + args, err := ec.field_Mutation_updateGQLUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateGQLUserRequest(childComplexity, args["id"].(string), args["title"].(*string), args["request"].(*string)), true + + case "Mutation.updateInfraConfigs": + if e.complexity.Mutation.UpdateInfraConfigs == nil { + break + } + + args, err := ec.field_Mutation_updateInfraConfigs_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateInfraConfigs(childComplexity, args["infraConfigs"].([]*dto.InfraConfigArgs)), true + + case "Mutation.updateLookUpRequestOrder": + if e.complexity.Mutation.UpdateLookUpRequestOrder == nil { + break + } + + args, err := ec.field_Mutation_updateLookUpRequestOrder_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateLookUpRequestOrder(childComplexity, args["collectionID"].(string), args["nextRequestID"].(*string), args["requestID"].(string)), true + + case "Mutation.updateRESTUserRequest": + if e.complexity.Mutation.UpdateRESTUserRequest == nil { + break + } + + args, err := ec.field_Mutation_updateRESTUserRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateRESTUserRequest(childComplexity, args["id"].(string), args["title"].(*string), args["request"].(*string)), true + + case "Mutation.updateRequest": + if e.complexity.Mutation.UpdateRequest == nil { + break + } + + args, err := ec.field_Mutation_updateRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateRequest(childComplexity, args["requestID"].(string), args["data"].(dto.UpdateTeamRequestInput)), true + + case "Mutation.updateTeamCollection": + if e.complexity.Mutation.UpdateTeamCollection == nil { + break + } + + args, err := ec.field_Mutation_updateTeamCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateTeamCollection(childComplexity, args["collectionID"].(string), args["newTitle"].(*string), args["data"].(*string)), true + + case "Mutation.updateTeamEnvironment": + if e.complexity.Mutation.UpdateTeamEnvironment == nil { + break + } + + args, err := ec.field_Mutation_updateTeamEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateTeamEnvironment(childComplexity, args["id"].(string), args["name"].(string), args["variables"].(string)), true + + case "Mutation.updateTeamMemberRole": + if e.complexity.Mutation.UpdateTeamMemberRole == nil { + break + } + + args, err := ec.field_Mutation_updateTeamMemberRole_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateTeamMemberRole(childComplexity, args["teamID"].(string), args["userUid"].(string), args["newRole"].(model.TeamMemberRole)), true + + case "Mutation.updateUserCollection": + if e.complexity.Mutation.UpdateUserCollection == nil { + break + } + + args, err := ec.field_Mutation_updateUserCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateUserCollection(childComplexity, args["userCollectionID"].(string), args["newTitle"].(*string), args["data"].(*string)), true + + case "Mutation.updateUserCollectionOrder": + if e.complexity.Mutation.UpdateUserCollectionOrder == nil { + break + } + + args, err := ec.field_Mutation_updateUserCollectionOrder_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateUserCollectionOrder(childComplexity, args["collectionID"].(string), args["nextCollectionID"].(*string)), true + + case "Mutation.updateUserEnvironment": + if e.complexity.Mutation.UpdateUserEnvironment == nil { + break + } + + args, err := ec.field_Mutation_updateUserEnvironment_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateUserEnvironment(childComplexity, args["id"].(string), args["name"].(string), args["variables"].(string)), true + + case "Mutation.updateUserSessions": + if e.complexity.Mutation.UpdateUserSessions == nil { + break + } + + args, err := ec.field_Mutation_updateUserSessions_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateUserSessions(childComplexity, args["currentSession"].(string), args["sessionType"].(model.ReqType)), true + + case "Mutation.updateUserSettings": + if e.complexity.Mutation.UpdateUserSettings == nil { + break + } + + args, err := ec.field_Mutation_updateUserSettings_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateUserSettings(childComplexity, args["properties"].(string)), true + + case "Query.admin": + if e.complexity.Query.Admin == nil { + break + } + + return e.complexity.Query.Admin(childComplexity), true + + case "Query.allowedAuthProviders": + if e.complexity.Query.AllowedAuthProviders == nil { + break + } + + return e.complexity.Query.AllowedAuthProviders(childComplexity), true + + case "Query.collection": + if e.complexity.Query.Collection == nil { + break + } + + args, err := ec.field_Query_collection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Collection(childComplexity, args["collectionID"].(string)), true + + case "Query.exportCollectionsToJSON": + if e.complexity.Query.ExportCollectionsToJSON == nil { + break + } + + args, err := ec.field_Query_exportCollectionsToJSON_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ExportCollectionsToJSON(childComplexity, args["teamID"].(string)), true + + case "Query.exportUserCollectionsToJSON": + if e.complexity.Query.ExportUserCollectionsToJSON == nil { + break + } + + args, err := ec.field_Query_exportUserCollectionsToJSON_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.ExportUserCollectionsToJSON(childComplexity, args["collectionID"].(*string), args["collectionType"].(model.ReqType)), true + + case "Query.infra": + if e.complexity.Query.Infra == nil { + break + } + + return e.complexity.Query.Infra(childComplexity), true + + case "Query.infraConfigs": + if e.complexity.Query.InfraConfigs == nil { + break + } + + args, err := ec.field_Query_infraConfigs_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.InfraConfigs(childComplexity, args["configNames"].([]dto.InfraConfigEnum)), true + + case "Query.me": + if e.complexity.Query.Me == nil { + break + } + + return e.complexity.Query.Me(childComplexity), true + + case "Query.myShortcodes": + if e.complexity.Query.MyShortcodes == nil { + break + } + + args, err := ec.field_Query_myShortcodes_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.MyShortcodes(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Query.myTeams": + if e.complexity.Query.MyTeams == nil { + break + } + + args, err := ec.field_Query_myTeams_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.MyTeams(childComplexity, args["cursor"].(*string)), true + + case "Query.request": + if e.complexity.Query.Request == nil { + break + } + + args, err := ec.field_Query_request_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Request(childComplexity, args["requestID"].(string)), true + + case "Query.requestsInCollection": + if e.complexity.Query.RequestsInCollection == nil { + break + } + + args, err := ec.field_Query_requestsInCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.RequestsInCollection(childComplexity, args["cursor"].(*string), args["take"].(*int), args["collectionID"].(string)), true + + case "Query.rootCollectionsOfTeam": + if e.complexity.Query.RootCollectionsOfTeam == nil { + break + } + + args, err := ec.field_Query_rootCollectionsOfTeam_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.RootCollectionsOfTeam(childComplexity, args["cursor"].(*string), args["take"].(*int), args["teamID"].(string)), true + + case "Query.rootGQLUserCollections": + if e.complexity.Query.RootGQLUserCollections == nil { + break + } + + args, err := ec.field_Query_rootGQLUserCollections_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.RootGQLUserCollections(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Query.rootRESTUserCollections": + if e.complexity.Query.RootRESTUserCollections == nil { + break + } + + args, err := ec.field_Query_rootRESTUserCollections_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.RootRESTUserCollections(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "Query.searchForRequest": + if e.complexity.Query.SearchForRequest == nil { + break + } + + args, err := ec.field_Query_searchForRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.SearchForRequest(childComplexity, args["cursor"].(*string), args["take"].(*int), args["teamID"].(string), args["searchTerm"].(string)), true + + case "Query.shortcode": + if e.complexity.Query.Shortcode == nil { + break + } + + args, err := ec.field_Query_shortcode_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Shortcode(childComplexity, args["code"].(string)), true + + case "Query.team": + if e.complexity.Query.Team == nil { + break + } + + args, err := ec.field_Query_team_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.Team(childComplexity, args["teamID"].(string)), true + + case "Query.teamInvitation": + if e.complexity.Query.TeamInvitation == nil { + break + } + + args, err := ec.field_Query_teamInvitation_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.TeamInvitation(childComplexity, args["inviteID"].(string)), true + + case "Query.userCollection": + if e.complexity.Query.UserCollection == nil { + break + } + + args, err := ec.field_Query_userCollection_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.UserCollection(childComplexity, args["userCollectionID"].(string)), true + + case "Query.userGQLRequests": + if e.complexity.Query.UserGQLRequests == nil { + break + } + + args, err := ec.field_Query_userGQLRequests_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.UserGQLRequests(childComplexity, args["cursor"].(*string), args["take"].(*int), args["collectionID"].(*string)), true + + case "Query.userRESTRequests": + if e.complexity.Query.UserRESTRequests == nil { + break + } + + args, err := ec.field_Query_userRESTRequests_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.UserRESTRequests(childComplexity, args["cursor"].(*string), args["take"].(*int), args["collectionID"].(*string)), true + + case "Query.userRequest": + if e.complexity.Query.UserRequest == nil { + break + } + + args, err := ec.field_Query_userRequest_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.UserRequest(childComplexity, args["id"].(string)), true + + case "RequestReorderData.nextRequest": + if e.complexity.RequestReorderData.NextRequest == nil { + break + } + + return e.complexity.RequestReorderData.NextRequest(childComplexity), true + + case "RequestReorderData.request": + if e.complexity.RequestReorderData.Request == nil { + break + } + + return e.complexity.RequestReorderData.Request(childComplexity), true + + case "Shortcode.createdOn": + if e.complexity.Shortcode.CreatedOn == nil { + break + } + + return e.complexity.Shortcode.CreatedOn(childComplexity), true + + case "Shortcode.properties": + if e.complexity.Shortcode.EmbedProperties == nil { + break + } + + return e.complexity.Shortcode.EmbedProperties(childComplexity), true + + case "Shortcode.id": + if e.complexity.Shortcode.ID == nil { + break + } + + return e.complexity.Shortcode.ID(childComplexity), true + + case "Shortcode.request": + if e.complexity.Shortcode.Request == nil { + break + } + + return e.complexity.Shortcode.Request(childComplexity), true + + case "ShortcodeCreator.email": + if e.complexity.ShortcodeCreator.Email == nil { + break + } + + return e.complexity.ShortcodeCreator.Email(childComplexity), true + + case "ShortcodeCreator.uid": + if e.complexity.ShortcodeCreator.UID == nil { + break + } + + return e.complexity.ShortcodeCreator.UID(childComplexity), true + + case "ShortcodeWithUserEmail.createdOn": + if e.complexity.ShortcodeWithUserEmail.CreatedOn == nil { + break + } + + return e.complexity.ShortcodeWithUserEmail.CreatedOn(childComplexity), true + + case "ShortcodeWithUserEmail.creator": + if e.complexity.ShortcodeWithUserEmail.Creator == nil { + break + } + + return e.complexity.ShortcodeWithUserEmail.Creator(childComplexity), true + + case "ShortcodeWithUserEmail.id": + if e.complexity.ShortcodeWithUserEmail.ID == nil { + break + } + + return e.complexity.ShortcodeWithUserEmail.ID(childComplexity), true + + case "ShortcodeWithUserEmail.properties": + if e.complexity.ShortcodeWithUserEmail.Properties == nil { + break + } + + return e.complexity.ShortcodeWithUserEmail.Properties(childComplexity), true + + case "ShortcodeWithUserEmail.request": + if e.complexity.ShortcodeWithUserEmail.Request == nil { + break + } + + return e.complexity.ShortcodeWithUserEmail.Request(childComplexity), true + + case "Subscription.collectionOrderUpdated": + if e.complexity.Subscription.CollectionOrderUpdated == nil { + break + } + + args, err := ec.field_Subscription_collectionOrderUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.CollectionOrderUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.myShortcodesCreated": + if e.complexity.Subscription.MyShortcodesCreated == nil { + break + } + + return e.complexity.Subscription.MyShortcodesCreated(childComplexity), true + + case "Subscription.myShortcodesRevoked": + if e.complexity.Subscription.MyShortcodesRevoked == nil { + break + } + + return e.complexity.Subscription.MyShortcodesRevoked(childComplexity), true + + case "Subscription.myShortcodesUpdated": + if e.complexity.Subscription.MyShortcodesUpdated == nil { + break + } + + return e.complexity.Subscription.MyShortcodesUpdated(childComplexity), true + + case "Subscription.requestMoved": + if e.complexity.Subscription.RequestMoved == nil { + break + } + + args, err := ec.field_Subscription_requestMoved_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.RequestMoved(childComplexity, args["teamID"].(string)), true + + case "Subscription.requestOrderUpdated": + if e.complexity.Subscription.RequestOrderUpdated == nil { + break + } + + args, err := ec.field_Subscription_requestOrderUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.RequestOrderUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamCollectionAdded": + if e.complexity.Subscription.TeamCollectionAdded == nil { + break + } + + args, err := ec.field_Subscription_teamCollectionAdded_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamCollectionAdded(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamCollectionMoved": + if e.complexity.Subscription.TeamCollectionMoved == nil { + break + } + + args, err := ec.field_Subscription_teamCollectionMoved_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamCollectionMoved(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamCollectionRemoved": + if e.complexity.Subscription.TeamCollectionRemoved == nil { + break + } + + args, err := ec.field_Subscription_teamCollectionRemoved_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamCollectionRemoved(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamCollectionUpdated": + if e.complexity.Subscription.TeamCollectionUpdated == nil { + break + } + + args, err := ec.field_Subscription_teamCollectionUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamCollectionUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamEnvironmentCreated": + if e.complexity.Subscription.TeamEnvironmentCreated == nil { + break + } + + args, err := ec.field_Subscription_teamEnvironmentCreated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamEnvironmentCreated(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamEnvironmentDeleted": + if e.complexity.Subscription.TeamEnvironmentDeleted == nil { + break + } + + args, err := ec.field_Subscription_teamEnvironmentDeleted_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamEnvironmentDeleted(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamEnvironmentUpdated": + if e.complexity.Subscription.TeamEnvironmentUpdated == nil { + break + } + + args, err := ec.field_Subscription_teamEnvironmentUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamEnvironmentUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamInvitationAdded": + if e.complexity.Subscription.TeamInvitationAdded == nil { + break + } + + args, err := ec.field_Subscription_teamInvitationAdded_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamInvitationAdded(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamInvitationRemoved": + if e.complexity.Subscription.TeamInvitationRemoved == nil { + break + } + + args, err := ec.field_Subscription_teamInvitationRemoved_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamInvitationRemoved(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamMemberAdded": + if e.complexity.Subscription.TeamMemberAdded == nil { + break + } + + args, err := ec.field_Subscription_teamMemberAdded_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamMemberAdded(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamMemberRemoved": + if e.complexity.Subscription.TeamMemberRemoved == nil { + break + } + + args, err := ec.field_Subscription_teamMemberRemoved_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamMemberRemoved(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamMemberUpdated": + if e.complexity.Subscription.TeamMemberUpdated == nil { + break + } + + args, err := ec.field_Subscription_teamMemberUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamMemberUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamRequestAdded": + if e.complexity.Subscription.TeamRequestAdded == nil { + break + } + + args, err := ec.field_Subscription_teamRequestAdded_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamRequestAdded(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamRequestDeleted": + if e.complexity.Subscription.TeamRequestDeleted == nil { + break + } + + args, err := ec.field_Subscription_teamRequestDeleted_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamRequestDeleted(childComplexity, args["teamID"].(string)), true + + case "Subscription.teamRequestUpdated": + if e.complexity.Subscription.TeamRequestUpdated == nil { + break + } + + args, err := ec.field_Subscription_teamRequestUpdated_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Subscription.TeamRequestUpdated(childComplexity, args["teamID"].(string)), true + + case "Subscription.userCollectionCreated": + if e.complexity.Subscription.UserCollectionCreated == nil { + break + } + + return e.complexity.Subscription.UserCollectionCreated(childComplexity), true + + case "Subscription.userCollectionMoved": + if e.complexity.Subscription.UserCollectionMoved == nil { + break + } + + return e.complexity.Subscription.UserCollectionMoved(childComplexity), true + + case "Subscription.userCollectionOrderUpdated": + if e.complexity.Subscription.UserCollectionOrderUpdated == nil { + break + } + + return e.complexity.Subscription.UserCollectionOrderUpdated(childComplexity), true + + case "Subscription.userCollectionRemoved": + if e.complexity.Subscription.UserCollectionRemoved == nil { + break + } + + return e.complexity.Subscription.UserCollectionRemoved(childComplexity), true + + case "Subscription.userCollectionUpdated": + if e.complexity.Subscription.UserCollectionUpdated == nil { + break + } + + return e.complexity.Subscription.UserCollectionUpdated(childComplexity), true + + case "Subscription.userDeleted": + if e.complexity.Subscription.UserDeleted == nil { + break + } + + return e.complexity.Subscription.UserDeleted(childComplexity), true + + case "Subscription.userEnvironmentCreated": + if e.complexity.Subscription.UserEnvironmentCreated == nil { + break + } + + return e.complexity.Subscription.UserEnvironmentCreated(childComplexity), true + + case "Subscription.userEnvironmentDeleteMany": + if e.complexity.Subscription.UserEnvironmentDeleteMany == nil { + break + } + + return e.complexity.Subscription.UserEnvironmentDeleteMany(childComplexity), true + + case "Subscription.userEnvironmentDeleted": + if e.complexity.Subscription.UserEnvironmentDeleted == nil { + break + } + + return e.complexity.Subscription.UserEnvironmentDeleted(childComplexity), true + + case "Subscription.userEnvironmentUpdated": + if e.complexity.Subscription.UserEnvironmentUpdated == nil { + break + } + + return e.complexity.Subscription.UserEnvironmentUpdated(childComplexity), true + + case "Subscription.userHistoryCreated": + if e.complexity.Subscription.UserHistoryCreated == nil { + break + } + + return e.complexity.Subscription.UserHistoryCreated(childComplexity), true + + case "Subscription.userHistoryDeleted": + if e.complexity.Subscription.UserHistoryDeleted == nil { + break + } + + return e.complexity.Subscription.UserHistoryDeleted(childComplexity), true + + case "Subscription.userHistoryDeletedMany": + if e.complexity.Subscription.UserHistoryDeletedMany == nil { + break + } + + return e.complexity.Subscription.UserHistoryDeletedMany(childComplexity), true + + case "Subscription.userHistoryUpdated": + if e.complexity.Subscription.UserHistoryUpdated == nil { + break + } + + return e.complexity.Subscription.UserHistoryUpdated(childComplexity), true + + case "Subscription.userInvited": + if e.complexity.Subscription.UserInvited == nil { + break + } + + return e.complexity.Subscription.UserInvited(childComplexity), true + + case "Subscription.userRequestCreated": + if e.complexity.Subscription.UserRequestCreated == nil { + break + } + + return e.complexity.Subscription.UserRequestCreated(childComplexity), true + + case "Subscription.userRequestDeleted": + if e.complexity.Subscription.UserRequestDeleted == nil { + break + } + + return e.complexity.Subscription.UserRequestDeleted(childComplexity), true + + case "Subscription.userRequestMoved": + if e.complexity.Subscription.UserRequestMoved == nil { + break + } + + return e.complexity.Subscription.UserRequestMoved(childComplexity), true + + case "Subscription.userRequestUpdated": + if e.complexity.Subscription.UserRequestUpdated == nil { + break + } + + return e.complexity.Subscription.UserRequestUpdated(childComplexity), true + + case "Subscription.userSettingsCreated": + if e.complexity.Subscription.UserSettingsCreated == nil { + break + } + + return e.complexity.Subscription.UserSettingsCreated(childComplexity), true + + case "Subscription.userSettingsUpdated": + if e.complexity.Subscription.UserSettingsUpdated == nil { + break + } + + return e.complexity.Subscription.UserSettingsUpdated(childComplexity), true + + case "Subscription.userUpdated": + if e.complexity.Subscription.UserUpdated == nil { + break + } + + return e.complexity.Subscription.UserUpdated(childComplexity), true + + case "Team.editorsCount": + if e.complexity.Team.EditorsCount == nil { + break + } + + return e.complexity.Team.EditorsCount(childComplexity), true + + case "Team.id": + if e.complexity.Team.ID == nil { + break + } + + return e.complexity.Team.ID(childComplexity), true + + case "Team.members": + if e.complexity.Team.Members == nil { + break + } + + args, err := ec.field_Team_members_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Team.Members(childComplexity, args["cursor"].(*string)), true + + case "Team.myRole": + if e.complexity.Team.MyRole == nil { + break + } + + return e.complexity.Team.MyRole(childComplexity), true + + case "Team.name": + if e.complexity.Team.Name == nil { + break + } + + return e.complexity.Team.Name(childComplexity), true + + case "Team.ownersCount": + if e.complexity.Team.OwnersCount == nil { + break + } + + return e.complexity.Team.OwnersCount(childComplexity), true + + case "Team.teamEnvironments": + if e.complexity.Team.TeamEnvironments == nil { + break + } + + return e.complexity.Team.TeamEnvironments(childComplexity), true + + case "Team.teamInvitations": + if e.complexity.Team.TeamInvitations == nil { + break + } + + return e.complexity.Team.TeamInvitations(childComplexity), true + + case "Team.teamMembers": + if e.complexity.Team.TeamMembers == nil { + break + } + + return e.complexity.Team.TeamMembers(childComplexity), true + + case "Team.viewersCount": + if e.complexity.Team.ViewersCount == nil { + break + } + + return e.complexity.Team.ViewersCount(childComplexity), true + + case "TeamCollection.children": + if e.complexity.TeamCollection.Children == nil { + break + } + + args, err := ec.field_TeamCollection_children_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.TeamCollection.Children(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "TeamCollection.data": + if e.complexity.TeamCollection.Data == nil { + break + } + + return e.complexity.TeamCollection.Data(childComplexity), true + + case "TeamCollection.id": + if e.complexity.TeamCollection.ID == nil { + break + } + + return e.complexity.TeamCollection.ID(childComplexity), true + + case "TeamCollection.parent": + if e.complexity.TeamCollection.Parent == nil { + break + } + + return e.complexity.TeamCollection.Parent(childComplexity), true + + case "TeamCollection.parentID": + if e.complexity.TeamCollection.ParentID == nil { + break + } + + return e.complexity.TeamCollection.ParentID(childComplexity), true + + case "TeamCollection.team": + if e.complexity.TeamCollection.Team == nil { + break + } + + return e.complexity.TeamCollection.Team(childComplexity), true + + case "TeamCollection.title": + if e.complexity.TeamCollection.Title == nil { + break + } + + return e.complexity.TeamCollection.Title(childComplexity), true + + case "TeamEnvironment.id": + if e.complexity.TeamEnvironment.ID == nil { + break + } + + return e.complexity.TeamEnvironment.ID(childComplexity), true + + case "TeamEnvironment.name": + if e.complexity.TeamEnvironment.Name == nil { + break + } + + return e.complexity.TeamEnvironment.Name(childComplexity), true + + case "TeamEnvironment.teamID": + if e.complexity.TeamEnvironment.TeamID == nil { + break + } + + return e.complexity.TeamEnvironment.TeamID(childComplexity), true + + case "TeamEnvironment.variables": + if e.complexity.TeamEnvironment.Variables == nil { + break + } + + return e.complexity.TeamEnvironment.Variables(childComplexity), true + + case "TeamInvitation.creator": + if e.complexity.TeamInvitation.Creator == nil { + break + } + + return e.complexity.TeamInvitation.Creator(childComplexity), true + + case "TeamInvitation.creatorUid": + if e.complexity.TeamInvitation.CreatorUID == nil { + break + } + + return e.complexity.TeamInvitation.CreatorUID(childComplexity), true + + case "TeamInvitation.id": + if e.complexity.TeamInvitation.ID == nil { + break + } + + return e.complexity.TeamInvitation.ID(childComplexity), true + + case "TeamInvitation.inviteeEmail": + if e.complexity.TeamInvitation.InviteeEmail == nil { + break + } + + return e.complexity.TeamInvitation.InviteeEmail(childComplexity), true + + case "TeamInvitation.inviteeRole": + if e.complexity.TeamInvitation.InviteeRole == nil { + break + } + + return e.complexity.TeamInvitation.InviteeRole(childComplexity), true + + case "TeamInvitation.team": + if e.complexity.TeamInvitation.Team == nil { + break + } + + return e.complexity.TeamInvitation.Team(childComplexity), true + + case "TeamInvitation.teamID": + if e.complexity.TeamInvitation.TeamID == nil { + break + } + + return e.complexity.TeamInvitation.TeamID(childComplexity), true + + case "TeamMember.membershipID": + if e.complexity.TeamMember.ID == nil { + break + } + + return e.complexity.TeamMember.ID(childComplexity), true + + case "TeamMember.role": + if e.complexity.TeamMember.Role == nil { + break + } + + return e.complexity.TeamMember.Role(childComplexity), true + + case "TeamMember.user": + if e.complexity.TeamMember.User == nil { + break + } + + return e.complexity.TeamMember.User(childComplexity), true + + case "TeamRequest.collection": + if e.complexity.TeamRequest.Collection == nil { + break + } + + return e.complexity.TeamRequest.Collection(childComplexity), true + + case "TeamRequest.collectionID": + if e.complexity.TeamRequest.CollectionID == nil { + break + } + + return e.complexity.TeamRequest.CollectionID(childComplexity), true + + case "TeamRequest.id": + if e.complexity.TeamRequest.ID == nil { + break + } + + return e.complexity.TeamRequest.ID(childComplexity), true + + case "TeamRequest.request": + if e.complexity.TeamRequest.Request == nil { + break + } + + return e.complexity.TeamRequest.Request(childComplexity), true + + case "TeamRequest.team": + if e.complexity.TeamRequest.Team == nil { + break + } + + return e.complexity.TeamRequest.Team(childComplexity), true + + case "TeamRequest.teamID": + if e.complexity.TeamRequest.TeamID == nil { + break + } + + return e.complexity.TeamRequest.TeamID(childComplexity), true + + case "TeamRequest.title": + if e.complexity.TeamRequest.Title == nil { + break + } + + return e.complexity.TeamRequest.Title(childComplexity), true + + case "User.createdOn": + if e.complexity.User.CreatedOn == nil { + break + } + + return e.complexity.User.CreatedOn(childComplexity), true + + case "User.currentGQLSession": + if e.complexity.User.CurrentGQLSession == nil { + break + } + + return e.complexity.User.CurrentGQLSession(childComplexity), true + + case "User.currentRESTSession": + if e.complexity.User.CurrentRESTSession == nil { + break + } + + return e.complexity.User.CurrentRESTSession(childComplexity), true + + case "User.displayName": + if e.complexity.User.DisplayName == nil { + break + } + + return e.complexity.User.DisplayName(childComplexity), true + + case "User.email": + if e.complexity.User.Email == nil { + break + } + + return e.complexity.User.Email(childComplexity), true + + case "User.environments": + if e.complexity.User.Environments == nil { + break + } + + return e.complexity.User.Environments(childComplexity), true + + case "User.GQLHistory": + if e.complexity.User.GQLHistory == nil { + break + } + + args, err := ec.field_User_GQLHistory_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.GQLHistory(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "User.globalEnvironments": + if e.complexity.User.GlobalEnvironments == nil { + break + } + + return e.complexity.User.GlobalEnvironments(childComplexity), true + + case "User.isAdmin": + if e.complexity.User.IsAdmin == nil { + break + } + + return e.complexity.User.IsAdmin(childComplexity), true + + case "User.photoURL": + if e.complexity.User.PhotoURL == nil { + break + } + + return e.complexity.User.PhotoURL(childComplexity), true + + case "User.RESTHistory": + if e.complexity.User.RESTHistory == nil { + break + } + + args, err := ec.field_User_RESTHistory_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.RESTHistory(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "User.settings": + if e.complexity.User.Settings == nil { + break + } + + return e.complexity.User.Settings(childComplexity), true + + case "User.uid": + if e.complexity.User.UID == nil { + break + } + + return e.complexity.User.UID(childComplexity), true + + case "UserCollection.childrenGQL": + if e.complexity.UserCollection.ChildrenGql == nil { + break + } + + args, err := ec.field_UserCollection_childrenGQL_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.UserCollection.ChildrenGql(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "UserCollection.childrenREST": + if e.complexity.UserCollection.ChildrenRest == nil { + break + } + + args, err := ec.field_UserCollection_childrenREST_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.UserCollection.ChildrenRest(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "UserCollection.data": + if e.complexity.UserCollection.Data == nil { + break + } + + return e.complexity.UserCollection.Data(childComplexity), true + + case "UserCollection.id": + if e.complexity.UserCollection.ID == nil { + break + } + + return e.complexity.UserCollection.ID(childComplexity), true + + case "UserCollection.parent": + if e.complexity.UserCollection.Parent == nil { + break + } + + return e.complexity.UserCollection.Parent(childComplexity), true + + case "UserCollection.requests": + if e.complexity.UserCollection.Requests == nil { + break + } + + args, err := ec.field_UserCollection_requests_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.UserCollection.Requests(childComplexity, args["cursor"].(*string), args["take"].(*int)), true + + case "UserCollection.title": + if e.complexity.UserCollection.Title == nil { + break + } + + return e.complexity.UserCollection.Title(childComplexity), true + + case "UserCollection.type": + if e.complexity.UserCollection.Type == nil { + break + } + + return e.complexity.UserCollection.Type(childComplexity), true + + case "UserCollection.user": + if e.complexity.UserCollection.User == nil { + break + } + + return e.complexity.UserCollection.User(childComplexity), true + + case "UserCollectionExportJSONData.collectionType": + if e.complexity.UserCollectionExportJSONData.CollectionType == nil { + break + } + + return e.complexity.UserCollectionExportJSONData.CollectionType(childComplexity), true + + case "UserCollectionExportJSONData.exportedCollection": + if e.complexity.UserCollectionExportJSONData.ExportedCollection == nil { + break + } + + return e.complexity.UserCollectionExportJSONData.ExportedCollection(childComplexity), true + + case "UserCollectionRemovedData.id": + if e.complexity.UserCollectionRemovedData.ID == nil { + break + } + + return e.complexity.UserCollectionRemovedData.ID(childComplexity), true + + case "UserCollectionRemovedData.type": + if e.complexity.UserCollectionRemovedData.Type == nil { + break + } + + return e.complexity.UserCollectionRemovedData.Type(childComplexity), true + + case "UserCollectionReorderData.nextUserCollection": + if e.complexity.UserCollectionReorderData.NextUserCollection == nil { + break + } + + return e.complexity.UserCollectionReorderData.NextUserCollection(childComplexity), true + + case "UserCollectionReorderData.userCollection": + if e.complexity.UserCollectionReorderData.UserCollection == nil { + break + } + + return e.complexity.UserCollectionReorderData.UserCollection(childComplexity), true + + case "UserEnvironment.id": + if e.complexity.UserEnvironment.ID == nil { + break + } + + return e.complexity.UserEnvironment.ID(childComplexity), true + + case "UserEnvironment.isGlobal": + if e.complexity.UserEnvironment.IsGlobal == nil { + break + } + + return e.complexity.UserEnvironment.IsGlobal(childComplexity), true + + case "UserEnvironment.name": + if e.complexity.UserEnvironment.Name == nil { + break + } + + return e.complexity.UserEnvironment.Name(childComplexity), true + + case "UserEnvironment.userUid": + if e.complexity.UserEnvironment.UserUID == nil { + break + } + + return e.complexity.UserEnvironment.UserUID(childComplexity), true + + case "UserEnvironment.variables": + if e.complexity.UserEnvironment.Variables == nil { + break + } + + return e.complexity.UserEnvironment.Variables(childComplexity), true + + case "UserHistory.executedOn": + if e.complexity.UserHistory.ExecutedOn == nil { + break + } + + return e.complexity.UserHistory.ExecutedOn(childComplexity), true + + case "UserHistory.id": + if e.complexity.UserHistory.ID == nil { + break + } + + return e.complexity.UserHistory.ID(childComplexity), true + + case "UserHistory.isStarred": + if e.complexity.UserHistory.IsStarred == nil { + break + } + + return e.complexity.UserHistory.IsStarred(childComplexity), true + + case "UserHistory.reqType": + if e.complexity.UserHistory.ReqType == nil { + break + } + + return e.complexity.UserHistory.ReqType(childComplexity), true + + case "UserHistory.request": + if e.complexity.UserHistory.Request == nil { + break + } + + return e.complexity.UserHistory.Request(childComplexity), true + + case "UserHistory.responseMetadata": + if e.complexity.UserHistory.ResponseMetadata == nil { + break + } + + return e.complexity.UserHistory.ResponseMetadata(childComplexity), true + + case "UserHistory.userUid": + if e.complexity.UserHistory.UserUID == nil { + break + } + + return e.complexity.UserHistory.UserUID(childComplexity), true + + case "UserHistoryDeletedManyData.count": + if e.complexity.UserHistoryDeletedManyData.Count == nil { + break + } + + return e.complexity.UserHistoryDeletedManyData.Count(childComplexity), true + + case "UserHistoryDeletedManyData.reqType": + if e.complexity.UserHistoryDeletedManyData.ReqType == nil { + break + } + + return e.complexity.UserHistoryDeletedManyData.ReqType(childComplexity), true + + case "UserRequest.collectionID": + if e.complexity.UserRequest.CollectionID == nil { + break + } + + return e.complexity.UserRequest.CollectionID(childComplexity), true + + case "UserRequest.createdOn": + if e.complexity.UserRequest.CreatedOn == nil { + break + } + + return e.complexity.UserRequest.CreatedOn(childComplexity), true + + case "UserRequest.id": + if e.complexity.UserRequest.ID == nil { + break + } + + return e.complexity.UserRequest.ID(childComplexity), true + + case "UserRequest.request": + if e.complexity.UserRequest.Request == nil { + break + } + + return e.complexity.UserRequest.Request(childComplexity), true + + case "UserRequest.title": + if e.complexity.UserRequest.Title == nil { + break + } + + return e.complexity.UserRequest.Title(childComplexity), true + + case "UserRequest.type": + if e.complexity.UserRequest.Type == nil { + break + } + + return e.complexity.UserRequest.Type(childComplexity), true + + case "UserRequest.user": + if e.complexity.UserRequest.User == nil { + break + } + + return e.complexity.UserRequest.User(childComplexity), true + + case "UserRequestReorderData.nextRequest": + if e.complexity.UserRequestReorderData.NextRequest == nil { + break + } + + return e.complexity.UserRequestReorderData.NextRequest(childComplexity), true + + case "UserRequestReorderData.request": + if e.complexity.UserRequestReorderData.Request == nil { + break + } + + return e.complexity.UserRequestReorderData.Request(childComplexity), true + + case "UserSettings.id": + if e.complexity.UserSettings.ID == nil { + break + } + + return e.complexity.UserSettings.ID(childComplexity), true + + case "UserSettings.properties": + if e.complexity.UserSettings.Properties == nil { + break + } + + return e.complexity.UserSettings.Properties(childComplexity), true + + case "UserSettings.updatedOn": + if e.complexity.UserSettings.UpdatedOn == nil { + break + } + + return e.complexity.UserSettings.UpdatedOn(childComplexity), true + + case "UserSettings.userUid": + if e.complexity.UserSettings.UserUID == nil { + break + } + + return e.complexity.UserSettings.UserUID(childComplexity), true + + } + return 0, false +} + +func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { + rc := graphql.GetOperationContext(ctx) + ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputCreateTeamRequestInput, + ec.unmarshalInputEnableAndDisableSSOArgs, + ec.unmarshalInputInfraConfigArgs, + ec.unmarshalInputUpdateTeamRequestInput, + ) + first := true + + switch rc.Operation.Operation { + case ast.Query: + return func(ctx context.Context) *graphql.Response { + var response graphql.Response + var data graphql.Marshaler + if first { + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data = ec._Query(ctx, rc.Operation.SelectionSet) + } else { + if atomic.LoadInt32(&ec.pendingDeferred) > 0 { + result := <-ec.deferredResults + atomic.AddInt32(&ec.pendingDeferred, -1) + data = result.Result + response.Path = result.Path + response.Label = result.Label + response.Errors = result.Errors + } else { + return nil + } + } + var buf bytes.Buffer + data.MarshalGQL(&buf) + response.Data = buf.Bytes() + if atomic.LoadInt32(&ec.deferred) > 0 { + hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 + response.HasNext = &hasNext + } + + return &response + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Subscription: + next := ec._Subscription(ctx, rc.Operation.SelectionSet) + + var buf bytes.Buffer + return func(ctx context.Context) *graphql.Response { + buf.Reset() + data := next(ctx) + + if data == nil { + return nil + } + data.MarshalGQL(&buf) + + return &graphql.Response{ + Data: buf.Bytes(), + } + } + + default: + return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) + } +} + +type executionContext struct { + *graphql.OperationContext + *executableSchema + deferred int32 + pendingDeferred int32 + deferredResults chan graphql.DeferredResult +} + +func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { + atomic.AddInt32(&ec.pendingDeferred, 1) + go func() { + ctx := graphql.WithFreshResponseContext(dg.Context) + dg.FieldSet.Dispatch(ctx) + ds := graphql.DeferredResult{ + Path: dg.Path, + Label: dg.Label, + Result: dg.FieldSet, + Errors: graphql.GetErrors(ctx), + } + // null fields should bubble up + if dg.FieldSet.Invalids > 0 { + ds.Result = graphql.Null + } + ec.deferredResults <- ds + }() +} + +func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapSchema(ec.Schema()), nil +} + +func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { + if ec.DisableIntrospection { + return nil, errors.New("introspection disabled") + } + return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil +} + +var sources = []*ast.Source{ + {Name: "../../api/graphql/schema.graphqls", Input: `directive @isLogin on FIELD_DEFINITION +directive @isAdmin on FIELD_DEFINITION + +type User { + """UID of the user""" + uid: ID! + + """Name of the user (if fetched)""" + displayName: String + + """Email of the user""" + email: String + + """URL to the profile photo of the user (if fetched)""" + photoURL: String + + """Flag to determine if user is an Admin or not""" + isAdmin: Boolean! + + """Date when the user account was created""" + createdOn: DateTime! + + """Stringified current REST session for logged-in User""" + currentRESTSession: String + + """Stringified current GraphQL session for logged-in User""" + currentGQLSession: String + + """Returns user settings""" + settings: UserSettings! + + """Returns a list of users personal environments""" + environments: [UserEnvironment!]! + + """Returns the users global environments""" + globalEnvironments: UserEnvironment! + + """Returns a users REST history""" + RESTHistory( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserHistory!]! + + """Returns a users GraphQL history""" + GQLHistory( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserHistory!]! +} + +""" +A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format. +""" +scalar DateTime + +type UserSettings { + """ID of the User Setting""" + id: ID! + + """ID of the user this setting belongs to""" + userUid: ID! + + """Stringified JSON settings object""" + properties: String! + + """Last updated on""" + updatedOn: DateTime! +} + +type UserEnvironment { + """ID of the User Environment""" + id: ID! + + """ID of the user this environment belongs to""" + userUid: ID! + + """Name of the environment""" + name: String + + """All variables present in the environment""" + variables: String! + + """Flag to indicate the environment is global or not""" + isGlobal: Boolean! +} + +type UserCollection { + """ID of the user collection""" + id: ID! + + """Displayed title of the user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + + """Type of the user collection""" + type: ReqType! + + """Returns user requests of a user collection""" + requests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserRequest!]! + + """User the collection belongs to""" + user: User! + + """Parent user collection (null if root)""" + parent: UserCollection + + """List of children REST user collection""" + childrenREST( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """List of children GraphQL user collection""" + childrenGQL( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! +} + +enum ReqType { + REST + GQL +} + +type UserCollectionReorderData { + """User Collection being moved""" + userCollection: UserCollection! + + """ + User Collection succeeding the collection being moved in its new position + """ + nextUserCollection: UserCollection +} + +type UserCollectionRemovedData { + """ID of User Collection being removed""" + id: ID! + + """Type of the user collection""" + type: ReqType! +} + +type UserCollectionExportJSONData { + """Stringified contents of the collection""" + exportedCollection: ID! + + """Type of the user collection""" + collectionType: ReqType! +} + +type UserRequest { + """ID of the user request""" + id: ID! + + """ID of the parent collection ID""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """Content/Body of the user request""" + request: String! + + """Type (GRAPHQL/REST) of the user request""" + type: ReqType! + + """Date of the user request creation""" + createdOn: DateTime! + + """Returns the user of the user request""" + user: User! +} + +type UserRequestReorderData { + """User request being moved""" + request: UserRequest! + + """User request succeeding the request being moved in its new position""" + nextRequest: UserRequest +} + +type UserHistory { + """ID of the user request in history""" + id: ID! + + """ID of the user this history belongs to""" + userUid: ID! + + """Type of the request in the history""" + reqType: ReqType! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the response meta-data""" + responseMetadata: String! + + """If the request in the history starred""" + isStarred: Boolean! + + """Timestamp of when the request was executed or history was created""" + executedOn: DateTime! +} + +type UserHistoryDeletedManyData { + """Number of user histories deleted""" + count: Int! + + """Type of the request in the history""" + reqType: ReqType! +} + +type Team { + """ID of the team""" + id: ID! + + """Displayed name of the team""" + name: String! + + """Returns the list of members of a team""" + members( + """The ID of the last returned team member entry (used for pagination)""" + cursor: ID + ): [TeamMember!]! + + """Returns the list of members of a team""" + teamMembers: [TeamMember!]! + + """The role of the current user in the team""" + myRole: TeamMemberRole + + """The number of users with the OWNER role in the team""" + ownersCount: Int! + + """The number of users with the EDITOR role in the team""" + editorsCount: Int! + + """The number of users with the VIEWER role in the team""" + viewersCount: Int! + + """Get all the active invites in the team""" + teamInvitations: [TeamInvitation!]! + + """Returns all Team Environments for the given Team""" + teamEnvironments: [TeamEnvironment!]! +} + +enum TeamMemberRole { + OWNER + VIEWER + EDITOR +} + +type TeamMember { + """Membership ID of the Team Member""" + membershipID: ID! + + """Role of the given team member in the given team""" + role: TeamMemberRole! + user: User! +} + +type TeamEnvironment { + """ID of the Team Environment""" + id: ID! + + """ID of the team this environment belongs to""" + teamID: ID! + + """Name of the environment""" + name: String! + + """All variables present in the environment""" + variables: String! +} + +type TeamCollection { + """ID of the collection""" + id: ID! + + """Displayed title of the collection""" + title: String! + + """JSON string representing the collection data""" + data: String + + """ID of the collection""" + parentID: ID + + """Team the collection belongs to""" + team: Team! + + """Return the parent Team Collection (null if root )""" + parent: TeamCollection + + """List of children Team Collections""" + children( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [TeamCollection!]! +} + +type CollectionReorderData { + """Team Collection being moved""" + collection: TeamCollection! + + """ + Team Collection succeeding the collection being moved in its new position + """ + nextCollection: TeamCollection +} + +type TeamRequest { + """ID of the request""" + id: ID! + + """ID of the collection the request belongs to.""" + collectionID: ID! + + """ID of the team the request belongs to.""" + teamID: ID! + + """JSON string representing the request data""" + request: String! + + """Displayed title of the request""" + title: String! + + """Team the request belongs to""" + team: Team! + + """Collection the request belongs to""" + collection: TeamCollection! +} + +type RequestReorderData { + """Team Request being moved""" + request: TeamRequest! + + """Team Request succeeding the request being moved in its new position""" + nextRequest: TeamRequest +} + +type TeamInvitation { + """ID of the invite""" + id: ID! + + """ID of the team the invite is to""" + teamID: ID! + + """UID of the creator of the invite""" + creatorUid: ID! + + """Email of the invitee""" + inviteeEmail: String! + + """The role that will be given to the invitee""" + inviteeRole: TeamMemberRole! + + """Get the team associated to the invite""" + team: Team! + + """Get the creator of the invite""" + creator: User! +} + +type Admin { + """UID of the user""" + uid: ID! + + """Name of the user (if fetched)""" + displayName: String + + """Email of the user""" + email: String + + """URL to the profile photo of the user (if fetched)""" + photoURL: String + + """Date when the user account was created""" + createdOn: DateTime! + + """Returns a list of all admin users in infra""" + admins: [User!]! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Returns a user info by UID""" + userInfo( + """The user UID""" + userUid: ID! + ): User! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Returns a list of all the users in infra""" + allUsers( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [User!]! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Returns a list of all the invited users""" + invitedUsers: [InvitedUser!]! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Returns a list of all the teams in the infra""" + allTeams( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Team!]! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Returns a team info by ID when requested by Admin""" + teamInfo( + """Team ID for which info to fetch""" + teamID: ID! + ): Team! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return count of all the members in a team""" + membersCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return count of all the stored collections in a team""" + collectionCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return count of all the stored requests in a team""" + requestCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return count of all the stored environments in a team""" + environmentCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return all the pending invitations in a team""" + pendingInvitationCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): [TeamInvitation!]! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return total number of Users in organization""" + usersCount: Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return total number of Teams in organization""" + teamsCount: Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return total number of Team Collections in organization""" + teamCollectionsCount: Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") + + """Return total number of Team Requests in organization""" + teamRequestsCount: Int! @deprecated(reason: "Use ` + "`" + `infra` + "`" + ` query instead") +} + +type InvitedUser { + """Admin UID""" + adminUid: ID! + + """Admin email""" + adminEmail: String! + + """Invitee email""" + inviteeEmail: String! + + """Date when the user invitation was sent""" + invitedOn: DateTime! +} + +type Infra { + """Admin who executed the action""" + executedBy: Admin! + + """Returns a list of all admin users in infra""" + admins: [User!]! + + """Returns a user info by UID""" + userInfo( + """The user UID""" + userUid: ID! + ): User! + + """Returns a list of all the users in infra""" + allUsers( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [User!]! + + """Returns a list of all the invited users""" + invitedUsers: [InvitedUser!]! + + """Returns a list of all the teams in the infra""" + allTeams( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Team!]! + + """Returns a team info by ID when requested by Admin""" + teamInfo( + """Team ID for which info to fetch""" + teamID: ID! + ): Team! + + """Return count of all the members in a team""" + membersCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored collections in a team""" + collectionCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored requests in a team""" + requestCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return count of all the stored environments in a team""" + environmentCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): Int! + + """Return all the pending invitations in a team""" + pendingInvitationCountInTeam( + """Team ID for which team members to fetch""" + teamID: ID! + ): [TeamInvitation!]! + + """Return total number of Users in organization""" + usersCount: Int! + + """Return total number of Teams in organization""" + teamsCount: Int! + + """Return total number of Team Collections in organization""" + teamCollectionsCount: Int! + + """Return total number of Team Requests in organization""" + teamRequestsCount: Int! + + """Returns a list of all the shortcodes in the infra""" + allShortcodes( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Users email to filter shortcodes by""" + userEmail: String + ): [ShortcodeWithUserEmail!]! +} + +type Shortcode { + """The 12 digit alphanumeric code""" + id: ID! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the properties for an embed""" + properties: String + + """Timestamp of when the Shortcode was created""" + createdOn: DateTime! +} + +type ShortcodeCreator { + """Uid of user who created the shortcode""" + uid: String! + + """Email of user who created the shortcode""" + email: String! +} + +type ShortcodeWithUserEmail { + """The 12 digit alphanumeric code""" + id: ID! + + """JSON string representing the request data""" + request: String! + + """JSON string representing the properties for an embed""" + properties: String + + """Timestamp of when the Shortcode was created""" + createdOn: DateTime! + + """Details of user who created the shortcode""" + creator: ShortcodeCreator +} + +type InfraConfig { + """Infra Config Name""" + name: String! + + """Infra Config Value""" + value: String! +} + +type Query { + """ + Gives details of the user executing this query (pass Authorization 'Bearer' header) + """ + me: User! @isLogin + + """Fetch details of the Infrastructure""" + infra: Infra! + + """Retrieve configuration details for the instance""" + infraConfigs( + """Configs to fetch""" + configNames: [InfraConfigEnum!]! + ): [InfraConfig!]! + + """Allowed Auth Provider list""" + allowedAuthProviders: [String!]! + + """Gives details of the admin executing this query""" + admin: Admin! + + """List of teams that the executing user belongs to.""" + myTeams( + """The ID of the last returned team entry (used for pagination)""" + cursor: ID + ): [Team!]! + + """Returns the detail of the team with the given ID""" + team( + """ID of the team to check""" + teamID: ID! + ): Team + + """Gets the Team Invitation with the given ID, or null if not exists""" + teamInvitation( + """ID of the Team Invitation to lookup""" + inviteID: ID! + ): TeamInvitation! + + """ + Returns the JSON string giving the collections and their contents of the team + """ + exportCollectionsToJSON( + """ID of the team""" + teamID: ID! + ): String! + + """Returns the collections of a team""" + rootCollectionsOfTeam( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the team""" + teamID: ID! + ): [TeamCollection!]! + + """Get a Team Collection with ID or null (if not exists)""" + collection( + """ID of the collection""" + collectionID: ID! + ): TeamCollection + + """Search the team for a specific request with title""" + searchForRequest( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the team to look in""" + teamID: ID! + + """The title to search for""" + searchTerm: String! + ): [TeamRequest!]! + + """Gives a request with the given ID or null (if not exists)""" + request( + """ID of the request""" + requestID: ID! + ): TeamRequest + + """Gives a paginated list of requests in the collection""" + requestsInCollection( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """ID of the collection to look in""" + collectionID: ID! + ): [TeamRequest!]! + + """Resolves and returns a shortcode data""" + shortcode( + """The shortcode to resolve""" + code: ID! + ): Shortcode + + """List all shortcodes the current user has generated""" + myShortcodes( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [Shortcode!]! + + """Get REST user requests""" + userRESTRequests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Collection ID of the user request""" + collectionID: ID + ): [UserRequest!]! + + """Get GraphQL user requests""" + userGQLRequests( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + + """Collection ID of the user request""" + collectionID: ID + ): [UserRequest!]! + + """Get a user request by ID""" + userRequest( + """ID of the user request""" + id: ID! + ): UserRequest! + + """Get the root REST user collections for a user""" + rootRESTUserCollections( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """Get the root GraphQL user collections for a user""" + rootGQLUserCollections( + """Cursor for pagination, ID of the last item in the list""" + cursor: ID + + """Number of items to fetch""" + take: Int = 10 + ): [UserCollection!]! + + """Get user collection with ID""" + userCollection( + """ID of the user collection""" + userCollectionID: ID! + ): UserCollection! + + """ + Returns the JSON string giving the collections and their contents of a user + """ + exportUserCollectionsToJSON( + """ID of the user collection""" + collectionID: ID = null + + """Type of the user collection""" + collectionType: ReqType! + ): UserCollectionExportJSONData! +} + +enum InfraConfigEnum { + MAILER_SMTP_URL + MAILER_ADDRESS_FROM + GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET + GITHUB_CLIENT_ID + GITHUB_CLIENT_SECRET + MICROSOFT_CLIENT_ID + MICROSOFT_CLIENT_SECRET +} + +type Mutation { + """Update user sessions""" + updateUserSessions( + """JSON string of the saved REST/GQL session""" + currentSession: String! + + """Type of the session""" + sessionType: SessionType! + ): User! + + """Delete an user account""" + deleteUser: Boolean! + + """Update Infra Configs""" + updateInfraConfigs( + """InfraConfigs to update""" + infraConfigs: [InfraConfigArgs!]! + ): [InfraConfig!]! + + """Reset Infra Configs with default values (.env)""" + resetInfraConfigs: Boolean! + + """Enable or Disable SSO for login/signup""" + enableAndDisableSSO( + """SSO provider and status""" + providerInfo: [EnableAndDisableSSOArgs!]! + ): Boolean! + + """Invite a user to the infra using email""" + inviteNewUser( + """invitee email""" + inviteeEmail: String! + ): InvitedUser! + + """Delete an user account from infra""" + removeUserByAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Make user an admin""" + makeUserAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Remove user as admin""" + removeUserAsAdmin( + """users UID""" + userUID: ID! + ): Boolean! + + """Create a new team by providing the user uid to nominate as Team owner""" + createTeamByAdmin( + """users uid to make team owner""" + userUid: ID! + + """Displayed name of the team""" + name: String! + ): Team! + + """Change the role of a user in a team""" + changeUserRoleInTeamByAdmin( + """users UID""" + userUID: ID! + + """team ID""" + teamID: ID! + + """updated team role""" + newRole: TeamMemberRole! + ): TeamMember! + + """Remove the user from a team""" + removeUserFromTeamByAdmin( + """users UID""" + userUid: ID! + + """team ID""" + teamID: ID! + ): Boolean! + + """Add a user to a team with email and team member role""" + addUserToTeamByAdmin( + """team ID""" + teamID: ID! + + """The role of the user to add in the team""" + role: TeamMemberRole! + + """Email of the user to add to team""" + userEmail: String! + ): TeamMember! + + """Change a team name""" + renameTeamByAdmin( + """ID of the team""" + teamID: ID! + + """The updated name of the team""" + newName: String! + ): Team! + + """Delete a team""" + deleteTeamByAdmin( + """ID of the team""" + teamID: ID! + ): Boolean! + + """Revoke a team Invite by Invite ID""" + revokeTeamInviteByAdmin( + """Team Invite ID""" + inviteID: ID! + ): Boolean! + + """Revoke Shortcode by ID""" + revokeShortcodeByAdmin( + """The shortcode to delete""" + code: ID! + ): Boolean! + + """Creates a team owned by the executing user""" + createTeam( + """Displayed name of the team""" + name: String! + ): Team! + + """Leaves a team the executing user is a part of""" + leaveTeam( + """ID of the Team to leave""" + teamID: ID! + ): Boolean! + + """Removes the team member from the team""" + removeTeamMember( + """ID of the Team to remove user from""" + teamID: ID! + + """ID of the user to remove from the given team""" + userUid: ID! + ): Boolean! + + """Renames a team""" + renameTeam( + """ID of the team""" + teamID: ID! + + """The updated name of the team""" + newName: String! + ): Team! + + """Deletes the team""" + deleteTeam( + """ID of the team""" + teamID: ID! + ): Boolean! + + """Update role of a team member the executing user owns""" + updateTeamMemberRole( + """ID of the affected team""" + teamID: ID! + + """UID of the affected user""" + userUid: ID! + + """Updated role value""" + newRole: TeamMemberRole! + ): TeamMember! + + """Creates a Team Invitation""" + createTeamInvitation( + """ID of the Team ID to invite from""" + teamID: ID! + + """Email of the user to invite""" + inviteeEmail: String! + + """Role to be given to the user""" + inviteeRole: TeamMemberRole! + ): TeamInvitation! + + """Revokes an invitation and deletes it""" + revokeTeamInvitation( + """ID of the invite to revoke""" + inviteID: ID! + ): Boolean! + + """Accept an Invitation""" + acceptTeamInvitation( + """ID of the Invite to accept""" + inviteID: ID! + ): TeamMember! + + """Create a new Team Environment for given Team ID""" + createTeamEnvironment( + """Name of the Team Environment""" + name: String! + + """ID of the Team""" + teamID: ID! + + """JSON string of the variables object""" + variables: String! + ): TeamEnvironment! + + """Delete a Team Environment for given Team ID""" + deleteTeamEnvironment( + """ID of the Team Environment""" + id: ID! + ): Boolean! + + """ + Add/Edit a single environment variable or variables to a Team Environment + """ + updateTeamEnvironment( + """ID of the Team Environment""" + id: ID! + + """Name of the Team Environment""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): TeamEnvironment! + + """Delete all variables from a Team Environment""" + deleteAllVariablesFromTeamEnvironment( + """ID of the Team Environment""" + id: ID! + ): TeamEnvironment! + + """Create a duplicate of an existing environment""" + createDuplicateEnvironment( + """ID of the Team Environment""" + id: ID! + ): TeamEnvironment! + + """ + Creates a collection at the root of the team hierarchy (no parent collection) + """ + createRootCollection( + """ID of the team""" + teamID: ID! + + """Title of the new collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Import collections from JSON string to the specified Team""" + importCollectionsFromJSON( + """Id of the team to add to""" + teamID: ID! + + """JSON string to import""" + jsonString: String! + + """ + ID to the collection to which to import to (null if to import to the root of team) + """ + parentCollectionID: ID + ): Boolean! + + """ + Replace existing collections of a specific team with collections in JSON string + """ + replaceCollectionsWithJSON( + """Id of the team to add to""" + teamID: ID! + + """JSON string to replace with""" + jsonString: String! + + """ + ID to the collection to which to import to (null if to import to the root of team) + """ + parentCollectionID: ID + ): Boolean! + + """Create a collection that has a parent collection""" + createChildCollection( + """ID of the parent to the new collection""" + collectionID: ID! + + """Title of the new collection""" + childTitle: String! + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Rename a collection""" + renameCollection( + """ID of the collection""" + collectionID: ID! + + """The updated title of the collection""" + newTitle: String! + ): TeamCollection! @deprecated(reason: "Switch to updateTeamCollection mutation instead") + + """Delete a collection""" + deleteCollection( + """ID of the collection""" + collectionID: ID! + ): Boolean! + + """Move a collection into a new parent collection or the root of the team""" + moveCollection( + """ID of the parent to the new collection""" + parentCollectionID: ID + + """ID of the collection""" + collectionID: ID! + ): TeamCollection! + + """Update the order of collections""" + updateCollectionOrder( + """ID of the collection""" + collectionID: ID! + + """ + ID of the collection that comes after the updated collection in its new position + """ + destCollID: ID + ): Boolean! + + """Update Team Collection details""" + updateTeamCollection( + """ID of the collection""" + collectionID: ID! + + """The updated title of the collection""" + newTitle: String + + """JSON string representing the collection data""" + data: String + ): TeamCollection! + + """Create a team request in the given collection.""" + createRequestInCollection( + """ID of the collection""" + collectionID: ID! + + """The request data (stringified JSON of Hoppscotch request object)""" + data: CreateTeamRequestInput! + ): TeamRequest! + + """Update a request with the given ID""" + updateRequest( + """ID of the request""" + requestID: ID! + + """ + The updated request data (stringified JSON of Hoppscotch request object) + """ + data: UpdateTeamRequestInput! + ): TeamRequest! + + """Delete a request with the given ID""" + deleteRequest( + """ID of the request""" + requestID: ID! + ): Boolean! + + """Update the order of requests in the lookup table""" + updateLookUpRequestOrder( + """ID of the collection""" + collectionID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + + """ID of the request to move""" + requestID: ID! + ): Boolean! + + """Move a request to the given collection""" + moveRequest( + """ID of the collection, the request belong to""" + srcCollID: ID + + """ID of the request to move""" + requestID: ID! + + """ID of the collection, where the request is moving to""" + destCollID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + ): TeamRequest! + + """Create a shortcode for the given request.""" + createShortcode( + """JSON string of the request object""" + request: String! + + """JSON string of the properties of the embed""" + properties: String + ): Shortcode! + + """Update a user generated Shortcode""" + updateEmbedProperties( + """The Shortcode to update""" + code: ID! + + """JSON string of the properties of the embed""" + properties: String! + ): Shortcode! + + """Revoke a user generated shortcode""" + revokeShortcode( + """The shortcode to remove""" + code: ID! + ): Boolean! + + """Creates a new user setting""" + createUserSettings( + """Stringified JSON settings object""" + properties: String! + ): UserSettings! + + """Update user setting for a given user""" + updateUserSettings( + """Stringified JSON settings object""" + properties: String! + ): UserSettings! + + """Create a new personal user environment for given user uid""" + createUserEnvironment( + """Name of the User Environment, if global send an empty string""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Create a new global user environment for given user uid""" + createUserGlobalEnvironment( + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Updates a users personal or global environment""" + updateUserEnvironment( + """ID of the user environment""" + id: ID! + + """Name of the User Environment, if global send an empty string""" + name: String! + + """JSON string of the variables object""" + variables: String! + ): UserEnvironment! + + """Deletes a users personal environment""" + deleteUserEnvironment( + """ID of the user environment""" + id: ID! + ): Boolean! + + """Deletes all of users personal environments""" + deleteUserEnvironments: Int! + + """Deletes all variables inside a users global environment""" + clearGlobalEnvironments( + """ID of the users global environment""" + id: ID! + ): UserEnvironment! + + """Adds a new REST/GQL request to user history""" + createUserHistory( + """JSON string of the request data""" + reqData: String! + + """JSON string of the response metadata""" + resMetadata: String! + + """Request type, REST or GQL""" + reqType: ReqType! + ): UserHistory! + + """Stars/Unstars a REST/GQL request in user history""" + toggleHistoryStarStatus( + """ID of User History""" + id: ID! + ): UserHistory! + + """Removes a REST/GQL request from user history""" + removeRequestFromHistory( + """ID of User History""" + id: ID! + ): UserHistory! + + """Deletes all REST/GQL history for a user based on Request type""" + deleteAllUserHistory( + """Request type, REST or GQL""" + reqType: ReqType! + ): UserHistoryDeletedManyData! + + """Create a new user REST request""" + createRESTUserRequest( + """Collection ID of the user request""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """content/body of the user request""" + request: String! + ): UserRequest! + + """Create a new user GraphQL request""" + createGQLUserRequest( + """Collection ID of the user request""" + collectionID: ID! + + """Title of the user request""" + title: String! + + """content/body of the user request""" + request: String! + ): UserRequest! + + """Update a user REST request""" + updateRESTUserRequest( + """ID of the user REST request""" + id: ID! + + """Title of the user request""" + title: String + + """content/body of the user request""" + request: String + ): UserRequest! + + """Update a user GraphQL request""" + updateGQLUserRequest( + """ID of the user GraphQL request""" + id: ID! + + """Title of the user request""" + title: String + + """content/body of the user request""" + request: String + ): UserRequest! + + """Delete a user request""" + deleteUserRequest( + """ID of the user request""" + id: ID! + ): Boolean! + + """Move and re-order of a user request within same or across collection""" + moveUserRequest( + """ID of the collection, where the request is belongs to""" + sourceCollectionID: ID! + + """ID of the request being moved""" + requestID: ID! + + """ID of the collection, where the request is moving to""" + destinationCollectionID: ID! + + """ + ID of the request that comes after the updated request in its new position + """ + nextRequestID: ID + ): UserRequest! + + """Creates root REST user collection(no parent user collection)""" + createRESTRootUserCollection( + """Title of the new user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates root GraphQL user collection(no parent user collection)""" + createGQLRootUserCollection( + """Title of the new user collection""" + title: String! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates a new child GraphQL user collection""" + createGQLChildUserCollection( + """Title of the new user collection""" + title: String! + + """ID of the parent to the new user collection""" + parentUserCollectionID: ID! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Creates a new child REST user collection""" + createRESTChildUserCollection( + """Title of the new user collection""" + title: String! + + """ID of the parent to the new user collection""" + parentUserCollectionID: ID! + + """JSON string representing the collection data""" + data: String + ): UserCollection! + + """Rename a user collection""" + renameUserCollection( + """ID of the user collection""" + userCollectionID: ID! + + """The updated title of the user collection""" + newTitle: String! + ): UserCollection! + + """Delete a user collection""" + deleteUserCollection( + """ID of the user collection""" + userCollectionID: ID! + ): Boolean! + + """Move user collection into new parent or root""" + moveUserCollection( + """ID of the parent to the new collection""" + destCollectionID: ID + + """ID of the collection""" + userCollectionID: ID! + ): UserCollection! + + """ + Update the order of UserCollections inside parent collection or in root + """ + updateUserCollectionOrder( + """ID of collection being moved""" + collectionID: ID! + + """ID of collection being moved""" + nextCollectionID: ID + ): Boolean! + + """Import collections from JSON string to the specified Team""" + importUserCollectionsFromJSON( + """JSON string to import""" + jsonString: String! + + """Type of UserCollection""" + reqType: ReqType! + + """ + ID to the collection to which to import into (null if to import into the root of the user) + """ + parentCollectionID: ID + ): Boolean! + + """Update a UserCollection""" + updateUserCollection( + """ID of the user collection""" + userCollectionID: ID! + + """The updated title of the user collection""" + newTitle: String + + """JSON string representing the collection data""" + data: String + ): UserCollection! +} + +enum SessionType { + REST + GQL +} + +input InfraConfigArgs { + """Infra Config Name""" + name: InfraConfigEnum! + + """Infra Config Value""" + value: String! +} + +input EnableAndDisableSSOArgs { + """Auth Provider""" + provider: AuthProvider! + + """Auth Provider Status""" + status: ServiceStatus! +} + +enum AuthProvider { + GOOGLE + GITHUB + MICROSOFT + EMAIL +} + +enum ServiceStatus { + ENABLE + DISABLE +} + +input CreateTeamRequestInput { + """ID of the team the collection belongs to""" + teamID: ID! + + """JSON string representing the request data""" + request: String! + + """Displayed title of the request""" + title: String! +} + +input UpdateTeamRequestInput { + """JSON string representing the request data""" + request: String + + """Displayed title of the request""" + title: String +} + +type Subscription { + """Listen for user updates""" + userUpdated: User! + + """Listen for user deletion""" + userDeleted: User! + + """Listen for User Invitation""" + userInvited: InvitedUser! + + """ + Listen to when a new team member being added to the team. The emitted value is the new team member added. + """ + teamMemberAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamMember! + + """ + Listen to when a team member status has been updated. The emitted value is the new team member status + """ + teamMemberUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamMember! + + """ + Listen to when a team member has been removed. The emitted value is the uid of the user removed + """ + teamMemberRemoved( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Listens to when a Team Invitation is added""" + teamInvitationAdded( + """ID of the Team to listen to""" + teamID: ID! + ): TeamInvitation! + + """Listens to when a Team Invitation is removed""" + teamInvitationRemoved( + """ID of the Team to listen to""" + teamID: ID! + ): ID! + + """Listen for Team Environment Updates""" + teamEnvironmentUpdated( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """Listen for Team Environment Creation Messages""" + teamEnvironmentCreated( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """Listen for Team Environment Deletion Messages""" + teamEnvironmentDeleted( + """ID of the Team""" + teamID: ID! + ): TeamEnvironment! + + """ + Listen to when a collection has been added to a team. The emitted value is the team added + """ + teamCollectionAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collection has been updated.""" + teamCollectionUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collection has been removed""" + teamCollectionRemoved( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Listen to when a collection has been moved""" + teamCollectionMoved( + """ID of the team to listen to""" + teamID: ID! + ): TeamCollection! + + """Listen to when a collections position has changed""" + collectionOrderUpdated( + """ID of the team to listen to""" + teamID: ID! + ): CollectionReorderData! + + """Emits when a new request is added to a team""" + teamRequestAdded( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """Emitted when a request has been updated""" + teamRequestUpdated( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """ + Emitted when a request has been deleted. Only the id of the request is emitted. + """ + teamRequestDeleted( + """ID of the team to listen to""" + teamID: ID! + ): ID! + + """Emitted when a requests position has been changed in its collection""" + requestOrderUpdated( + """ID of the team to listen to""" + teamID: ID! + ): RequestReorderData! + + """Emitted when a request has been moved from one collection into another""" + requestMoved( + """ID of the team to listen to""" + teamID: ID! + ): TeamRequest! + + """Listen for shortcode creation""" + myShortcodesCreated: Shortcode! + + """Listen for Shortcode updates""" + myShortcodesUpdated: Shortcode! + + """Listen for shortcode deletion""" + myShortcodesRevoked: Shortcode! + + """Listen for user setting creation""" + userSettingsCreated: UserSettings! + + """Listen for user setting updates""" + userSettingsUpdated: UserSettings! + + """Listen for User Environment Creation""" + userEnvironmentCreated: UserEnvironment! + + """Listen for User Environment updates""" + userEnvironmentUpdated: UserEnvironment! + + """Listen for User Environment deletion""" + userEnvironmentDeleted: UserEnvironment! + + """Listen for User Environment DeleteMany""" + userEnvironmentDeleteMany: Int! + + """Listen for User History Creation""" + userHistoryCreated: UserHistory! + + """Listen for User History update""" + userHistoryUpdated: UserHistory! + + """Listen for User History deletion""" + userHistoryDeleted: UserHistory! + + """Listen for User History deleted many""" + userHistoryDeletedMany: UserHistoryDeletedManyData! + + """Listen for User Request Creation""" + userRequestCreated: UserRequest! + + """Listen for User Request Update""" + userRequestUpdated: UserRequest! + + """Listen for User Request Deletion""" + userRequestDeleted: UserRequest! + + """Listen for User Request Moved""" + userRequestMoved: UserRequestReorderData! + + """Listen for User Collection Creation""" + userCollectionCreated: UserCollection! + + """Listen to when a User Collection has been updated.""" + userCollectionUpdated: UserCollection! + + """Listen to when a User Collection has been deleted""" + userCollectionRemoved: UserCollectionRemovedData! + + """Listen to when a User Collection has been moved""" + userCollectionMoved: UserCollection! + + """Listen to when a User Collections position has changed""" + userCollectionOrderUpdated: UserCollectionReorderData! +} +`, BuiltIn: false}, +} +var parsedSchema = gqlparser.MustLoadSchema(sources...) + +// endregion ************************** generated!.gotpl ************************** + +// region ***************************** args.gotpl ***************************** + +func (ec *executionContext) field_Admin_allTeams_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Admin_allUsers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Admin_collectionCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_environmentCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_membersCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_pendingInvitationCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_requestCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_teamInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Admin_userInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_allShortcodes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["userEmail"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userEmail")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userEmail"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Infra_allTeams_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Infra_allUsers_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Infra_collectionCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_environmentCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_membersCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_pendingInvitationCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_requestCountInTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_teamInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Infra_userInfo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_acceptTeamInvitation_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["inviteID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_addUserToTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 model.TeamMemberRole + if tmp, ok := rawArgs["role"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("role")) + arg1, err = ec.unmarshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, tmp) + if err != nil { + return nil, err + } + } + args["role"] = arg1 + var arg2 string + if tmp, ok := rawArgs["userEmail"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userEmail")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userEmail"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_changeUserRoleInTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg1 + var arg2 model.TeamMemberRole + if tmp, ok := rawArgs["newRole"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newRole")) + arg2, err = ec.unmarshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newRole"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_clearGlobalEnvironments_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createChildCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["childTitle"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("childTitle")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["childTitle"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createDuplicateEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createGQLChildUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg0 + var arg1 string + if tmp, ok := rawArgs["parentUserCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentUserCollectionID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentUserCollectionID"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createGQLRootUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createGQLUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg1 + var arg2 string + if tmp, ok := rawArgs["request"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["request"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createRESTChildUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg0 + var arg1 string + if tmp, ok := rawArgs["parentUserCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentUserCollectionID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentUserCollectionID"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createRESTRootUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createRESTUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg1 + var arg2 string + if tmp, ok := rawArgs["request"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["request"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createRequestInCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 dto.CreateTeamRequestInput + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg1, err = ec.unmarshalNCreateTeamRequestInput2dtoᚐCreateTeamRequestInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createRootCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createShortcode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["request"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["request"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["properties"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["properties"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg0 + var arg1 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createTeamEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + var arg1 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg1 + var arg2 string + if tmp, ok := rawArgs["variables"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("variables")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["variables"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createTeamInvitation_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["inviteeEmail"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteeEmail")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteeEmail"] = arg1 + var arg2 model.TeamMemberRole + if tmp, ok := rawArgs["inviteeRole"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteeRole")) + arg2, err = ec.unmarshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteeRole"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createUserEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + var arg1 string + if tmp, ok := rawArgs["variables"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("variables")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["variables"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_createUserGlobalEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["variables"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("variables")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["variables"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_createUserHistory_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["reqData"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reqData")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["reqData"] = arg0 + var arg1 string + if tmp, ok := rawArgs["resMetadata"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resMetadata")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["resMetadata"] = arg1 + var arg2 model.ReqType + if tmp, ok := rawArgs["reqType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reqType")) + arg2, err = ec.unmarshalNReqType2modelᚐReqType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["reqType"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_createUserSettings_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["properties"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["properties"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteAllUserHistory_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 model.ReqType + if tmp, ok := rawArgs["reqType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reqType")) + arg0, err = ec.unmarshalNReqType2modelᚐReqType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["reqType"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteAllVariablesFromTeamEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteTeamEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userCollectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userCollectionID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteUserEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_deleteUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_enableAndDisableSSO_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []*dto.EnableAndDisableSSOArgs + if tmp, ok := rawArgs["providerInfo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("providerInfo")) + arg0, err = ec.unmarshalNEnableAndDisableSSOArgs2ᚕᚖdtoᚐEnableAndDisableSSOArgsᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["providerInfo"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_importCollectionsFromJSON_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["jsonString"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jsonString")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["jsonString"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["parentCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentCollectionID")) + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentCollectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_importUserCollectionsFromJSON_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["jsonString"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jsonString")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["jsonString"] = arg0 + var arg1 model.ReqType + if tmp, ok := rawArgs["reqType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reqType")) + arg1, err = ec.unmarshalNReqType2modelᚐReqType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["reqType"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["parentCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentCollectionID")) + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentCollectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_inviteNewUser_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["inviteeEmail"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteeEmail")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteeEmail"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_leaveTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_makeUserAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_moveCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["parentCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentCollectionID")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentCollectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_moveRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["srcCollID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("srcCollID")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["srcCollID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg1 + var arg2 string + if tmp, ok := rawArgs["destCollID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destCollID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destCollID"] = arg2 + var arg3 *string + if tmp, ok := rawArgs["nextRequestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextRequestID")) + arg3, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nextRequestID"] = arg3 + return args, nil +} + +func (ec *executionContext) field_Mutation_moveUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["destCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destCollectionID")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destCollectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["userCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userCollectionID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userCollectionID"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_moveUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["sourceCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceCollectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["sourceCollectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg1 + var arg2 string + if tmp, ok := rawArgs["destinationCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destinationCollectionID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destinationCollectionID"] = arg2 + var arg3 *string + if tmp, ok := rawArgs["nextRequestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextRequestID")) + arg3, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nextRequestID"] = arg3 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeRequestFromHistory_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeTeamMember_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeUserAsAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeUserByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_removeUserFromTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg0 + var arg1 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_renameCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["newTitle"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newTitle")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newTitle"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_renameTeamByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["newName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newName")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newName"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_renameTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["newName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newName")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newName"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_renameUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userCollectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userCollectionID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["newTitle"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newTitle")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newTitle"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_replaceCollectionsWithJSON_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["jsonString"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("jsonString")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["jsonString"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["parentCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentCollectionID")) + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["parentCollectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_revokeShortcodeByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["code"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["code"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_revokeShortcode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["code"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["code"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_revokeTeamInvitation_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["inviteID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_revokeTeamInviteByAdmin_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["inviteID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_toggleHistoryStarStatus_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateCollectionOrder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["destCollID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("destCollID")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["destCollID"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateEmbedProperties_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["code"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["code"] = arg0 + var arg1 string + if tmp, ok := rawArgs["properties"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["properties"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateGQLUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["request"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["request"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateInfraConfigs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []*dto.InfraConfigArgs + if tmp, ok := rawArgs["infraConfigs"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("infraConfigs")) + arg0, err = ec.unmarshalNInfraConfigArgs2ᚕᚖdtoᚐInfraConfigArgsᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["infraConfigs"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateLookUpRequestOrder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["nextRequestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextRequestID")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nextRequestID"] = arg1 + var arg2 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateRESTUserRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["title"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["title"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["request"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["request"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg0 + var arg1 dto.UpdateTeamRequestInput + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg1, err = ec.unmarshalNUpdateTeamRequestInput2dtoᚐUpdateTeamRequestInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateTeamCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["newTitle"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newTitle")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newTitle"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateTeamEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + var arg1 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg1 + var arg2 string + if tmp, ok := rawArgs["variables"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("variables")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["variables"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateTeamMemberRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + var arg1 string + if tmp, ok := rawArgs["userUid"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userUid")) + arg1, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userUid"] = arg1 + var arg2 model.TeamMemberRole + if tmp, ok := rawArgs["newRole"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newRole")) + arg2, err = ec.unmarshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newRole"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUserCollectionOrder_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["nextCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextCollectionID")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["nextCollectionID"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUserCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userCollectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userCollectionID"] = arg0 + var arg1 *string + if tmp, ok := rawArgs["newTitle"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("newTitle")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["newTitle"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["data"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("data")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["data"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUserEnvironment_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + var arg1 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg1 + var arg2 string + if tmp, ok := rawArgs["variables"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("variables")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["variables"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUserSessions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["currentSession"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("currentSession")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["currentSession"] = arg0 + var arg1 model.ReqType + if tmp, ok := rawArgs["sessionType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sessionType")) + arg1, err = ec.unmarshalNSessionType2modelᚐReqType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["sessionType"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_updateUserSettings_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["properties"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("properties")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["properties"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["name"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_collection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_exportCollectionsToJSON_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_exportUserCollectionsToJSON_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg0 + var arg1 model.ReqType + if tmp, ok := rawArgs["collectionType"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionType")) + arg1, err = ec.unmarshalNReqType2modelᚐReqType(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionType"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_infraConfigs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []dto.InfraConfigEnum + if tmp, ok := rawArgs["configNames"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("configNames")) + arg0, err = ec.unmarshalNInfraConfigEnum2ᚕdtoᚐInfraConfigEnumᚄ(ctx, tmp) + if err != nil { + return nil, err + } + } + args["configNames"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_myShortcodes_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_myTeams_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_request_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["requestID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requestID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["requestID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_requestsInCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_rootCollectionsOfTeam_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_rootGQLUserCollections_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_rootRESTUserCollections_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Query_searchForRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg2, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg2 + var arg3 string + if tmp, ok := rawArgs["searchTerm"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("searchTerm")) + arg3, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["searchTerm"] = arg3 + return args, nil +} + +func (ec *executionContext) field_Query_shortcode_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["code"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("code")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["code"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_teamInvitation_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["inviteID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("inviteID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["inviteID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_team_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_userCollection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["userCollectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("userCollectionID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["userCollectionID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_userGQLRequests_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_userRESTRequests_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["collectionID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("collectionID")) + arg2, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["collectionID"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_userRequest_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_collectionOrderUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_requestMoved_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_requestOrderUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamCollectionAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamCollectionMoved_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamCollectionRemoved_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamCollectionUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamEnvironmentCreated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamEnvironmentDeleted_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamEnvironmentUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamInvitationAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamInvitationRemoved_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamMemberAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamMemberRemoved_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamMemberUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamRequestAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamRequestDeleted_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Subscription_teamRequestUpdated_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["teamID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["teamID"] = arg0 + return args, nil +} + +func (ec *executionContext) field_TeamCollection_children_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Team_members_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + return args, nil +} + +func (ec *executionContext) field_UserCollection_childrenGQL_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_UserCollection_childrenREST_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_UserCollection_requests_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_User_GQLHistory_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field_User_RESTHistory_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 *string + if tmp, ok := rawArgs["cursor"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("cursor")) + arg0, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["cursor"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["take"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("take")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } + } + args["take"] = arg1 + return args, nil +} + +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } + } + args["includeDeprecated"] = arg0 + return args, nil +} + +// endregion ***************************** args.gotpl ***************************** + +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + +// region **************************** field.gotpl ***************************** + +func (ec *executionContext) _Admin_uid(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_uid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_uid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_displayName(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_displayName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_email(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_email(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_photoURL(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_photoURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PhotoURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_photoURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_createdOn(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_createdOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_createdOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_admins(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_admins(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Admins, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.User) + fc.Result = res + return ec.marshalNUser2ᚕᚖmodelᚐUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_admins(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_userInfo(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_userInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_userInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_userInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_allUsers(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_allUsers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AllUsers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.User) + fc.Result = res + return ec.marshalNUser2ᚕᚖmodelᚐUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_allUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_allUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_invitedUsers(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_invitedUsers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InvitedUsers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.InvitedUser) + fc.Result = res + return ec.marshalNInvitedUser2ᚕᚖmodelᚐInvitedUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_invitedUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "adminUid": + return ec.fieldContext_InvitedUser_adminUid(ctx, field) + case "adminEmail": + return ec.fieldContext_InvitedUser_adminEmail(ctx, field) + case "inviteeEmail": + return ec.fieldContext_InvitedUser_inviteeEmail(ctx, field) + case "invitedOn": + return ec.fieldContext_InvitedUser_invitedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InvitedUser", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_allTeams(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_allTeams(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AllTeams, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚕᚖmodelᚐTeamᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_allTeams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_allTeams_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_teamInfo(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_teamInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_teamInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_teamInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_membersCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_membersCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MembersCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_membersCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_membersCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_collectionCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_collectionCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CollectionCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_collectionCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_collectionCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_requestCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_requestCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequestCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_requestCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_requestCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_environmentCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_environmentCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnvironmentCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_environmentCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_environmentCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_pendingInvitationCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_pendingInvitationCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PendingInvitationCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamInvitation) + fc.Result = res + return ec.marshalNTeamInvitation2ᚕᚖmodelᚐTeamInvitationᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_pendingInvitationCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Admin_pendingInvitationCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Admin_usersCount(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_usersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UsersCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_usersCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_teamsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_teamsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_teamsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_teamCollectionsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_teamCollectionsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamCollectionsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_teamCollectionsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Admin_teamRequestsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Admin) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Admin_teamRequestsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamRequestsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Admin_teamRequestsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Admin", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _CollectionReorderData_collection(ctx context.Context, field graphql.CollectedField, obj *dto.CollectionReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CollectionReorderData_collection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Collection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CollectionReorderData_collection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CollectionReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _CollectionReorderData_nextCollection(ctx context.Context, field graphql.CollectedField, obj *dto.CollectionReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CollectionReorderData_nextCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NextCollection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalOTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CollectionReorderData_nextCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CollectionReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_executedBy(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_executedBy(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExecutedBy, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*dto.Admin) + fc.Result = res + return ec.marshalNAdmin2ᚖdtoᚐAdmin(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_executedBy(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_Admin_uid(ctx, field) + case "displayName": + return ec.fieldContext_Admin_displayName(ctx, field) + case "email": + return ec.fieldContext_Admin_email(ctx, field) + case "photoURL": + return ec.fieldContext_Admin_photoURL(ctx, field) + case "createdOn": + return ec.fieldContext_Admin_createdOn(ctx, field) + case "admins": + return ec.fieldContext_Admin_admins(ctx, field) + case "userInfo": + return ec.fieldContext_Admin_userInfo(ctx, field) + case "allUsers": + return ec.fieldContext_Admin_allUsers(ctx, field) + case "invitedUsers": + return ec.fieldContext_Admin_invitedUsers(ctx, field) + case "allTeams": + return ec.fieldContext_Admin_allTeams(ctx, field) + case "teamInfo": + return ec.fieldContext_Admin_teamInfo(ctx, field) + case "membersCountInTeam": + return ec.fieldContext_Admin_membersCountInTeam(ctx, field) + case "collectionCountInTeam": + return ec.fieldContext_Admin_collectionCountInTeam(ctx, field) + case "requestCountInTeam": + return ec.fieldContext_Admin_requestCountInTeam(ctx, field) + case "environmentCountInTeam": + return ec.fieldContext_Admin_environmentCountInTeam(ctx, field) + case "pendingInvitationCountInTeam": + return ec.fieldContext_Admin_pendingInvitationCountInTeam(ctx, field) + case "usersCount": + return ec.fieldContext_Admin_usersCount(ctx, field) + case "teamsCount": + return ec.fieldContext_Admin_teamsCount(ctx, field) + case "teamCollectionsCount": + return ec.fieldContext_Admin_teamCollectionsCount(ctx, field) + case "teamRequestsCount": + return ec.fieldContext_Admin_teamRequestsCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Admin", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_admins(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_admins(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Admins, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.User) + fc.Result = res + return ec.marshalNUser2ᚕᚖmodelᚐUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_admins(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_userInfo(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_userInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_userInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_userInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_allUsers(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_allUsers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AllUsers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.User) + fc.Result = res + return ec.marshalNUser2ᚕᚖmodelᚐUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_allUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_allUsers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_invitedUsers(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_invitedUsers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InvitedUsers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.InvitedUser) + fc.Result = res + return ec.marshalNInvitedUser2ᚕᚖmodelᚐInvitedUserᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_invitedUsers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "adminUid": + return ec.fieldContext_InvitedUser_adminUid(ctx, field) + case "adminEmail": + return ec.fieldContext_InvitedUser_adminEmail(ctx, field) + case "inviteeEmail": + return ec.fieldContext_InvitedUser_inviteeEmail(ctx, field) + case "invitedOn": + return ec.fieldContext_InvitedUser_invitedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InvitedUser", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_allTeams(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_allTeams(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AllTeams, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚕᚖmodelᚐTeamᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_allTeams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_allTeams_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_teamInfo(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_teamInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamInfo, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_teamInfo(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_teamInfo_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_membersCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_membersCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MembersCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_membersCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_membersCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_collectionCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_collectionCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CollectionCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_collectionCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_collectionCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_requestCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_requestCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.RequestCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_requestCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_requestCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_environmentCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_environmentCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnvironmentCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_environmentCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_environmentCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_pendingInvitationCountInTeam(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_pendingInvitationCountInTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PendingInvitationCountInTeam, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamInvitation) + fc.Result = res + return ec.marshalNTeamInvitation2ᚕᚖmodelᚐTeamInvitationᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_pendingInvitationCountInTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_pendingInvitationCountInTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Infra_usersCount(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_usersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UsersCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_usersCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_teamsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_teamsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_teamsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_teamCollectionsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_teamCollectionsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamCollectionsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_teamCollectionsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_teamRequestsCount(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_teamRequestsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamRequestsCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_teamRequestsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Infra_allShortcodes(ctx context.Context, field graphql.CollectedField, obj *dto.Infra) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Infra_allShortcodes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AllShortcodes, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*dto.ShortcodeWithUserEmail) + fc.Result = res + return ec.marshalNShortcodeWithUserEmail2ᚕᚖdtoᚐShortcodeWithUserEmailᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Infra_allShortcodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Infra", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_ShortcodeWithUserEmail_id(ctx, field) + case "request": + return ec.fieldContext_ShortcodeWithUserEmail_request(ctx, field) + case "properties": + return ec.fieldContext_ShortcodeWithUserEmail_properties(ctx, field) + case "createdOn": + return ec.fieldContext_ShortcodeWithUserEmail_createdOn(ctx, field) + case "creator": + return ec.fieldContext_ShortcodeWithUserEmail_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ShortcodeWithUserEmail", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Infra_allShortcodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _InfraConfig_name(ctx context.Context, field graphql.CollectedField, obj *model.InfraConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InfraConfig_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InfraConfig_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InfraConfig", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InfraConfig_value(ctx context.Context, field graphql.CollectedField, obj *model.InfraConfig) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InfraConfig_value(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Value, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalNString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InfraConfig_value(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InfraConfig", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InvitedUser_adminUid(ctx context.Context, field graphql.CollectedField, obj *model.InvitedUser) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InvitedUser_adminUid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AdminUID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InvitedUser_adminUid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InvitedUser", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InvitedUser_adminEmail(ctx context.Context, field graphql.CollectedField, obj *model.InvitedUser) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InvitedUser_adminEmail(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.AdminEmail, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InvitedUser_adminEmail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InvitedUser", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InvitedUser_inviteeEmail(ctx context.Context, field graphql.CollectedField, obj *model.InvitedUser) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InvitedUser_inviteeEmail(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InviteeEmail, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InvitedUser_inviteeEmail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InvitedUser", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _InvitedUser_invitedOn(ctx context.Context, field graphql.CollectedField, obj *model.InvitedUser) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InvitedUser_invitedOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InvitedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_InvitedUser_invitedOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "InvitedUser", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUserSessions(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUserSessions(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUserSessions(rctx, fc.Args["currentSession"].(string), fc.Args["sessionType"].(model.ReqType)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUserSessions(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateUserSessions_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUser(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUser(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateInfraConfigs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateInfraConfigs(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateInfraConfigs(rctx, fc.Args["infraConfigs"].([]*dto.InfraConfigArgs)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.InfraConfig) + fc.Result = res + return ec.marshalNInfraConfig2ᚕᚖmodelᚐInfraConfigᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateInfraConfigs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_InfraConfig_name(ctx, field) + case "value": + return ec.fieldContext_InfraConfig_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InfraConfig", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateInfraConfigs_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_resetInfraConfigs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_resetInfraConfigs(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ResetInfraConfigs(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_resetInfraConfigs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_enableAndDisableSSO(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_enableAndDisableSSO(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().EnableAndDisableSso(rctx, fc.Args["providerInfo"].([]*dto.EnableAndDisableSSOArgs)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_enableAndDisableSSO(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_enableAndDisableSSO_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_inviteNewUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_inviteNewUser(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().InviteNewUser(rctx, fc.Args["inviteeEmail"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.InvitedUser) + fc.Result = res + return ec.marshalNInvitedUser2ᚖmodelᚐInvitedUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_inviteNewUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "adminUid": + return ec.fieldContext_InvitedUser_adminUid(ctx, field) + case "adminEmail": + return ec.fieldContext_InvitedUser_adminEmail(ctx, field) + case "inviteeEmail": + return ec.fieldContext_InvitedUser_inviteeEmail(ctx, field) + case "invitedOn": + return ec.fieldContext_InvitedUser_invitedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InvitedUser", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_inviteNewUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeUserByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeUserByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveUserByAdmin(rctx, fc.Args["userUID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeUserByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeUserByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_makeUserAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_makeUserAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MakeUserAdmin(rctx, fc.Args["userUID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_makeUserAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_makeUserAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeUserAsAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeUserAsAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveUserAsAdmin(rctx, fc.Args["userUID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeUserAsAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeUserAsAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateTeamByAdmin(rctx, fc.Args["userUid"].(string), fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_changeUserRoleInTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_changeUserRoleInTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ChangeUserRoleInTeamByAdmin(rctx, fc.Args["userUID"].(string), fc.Args["teamID"].(string), fc.Args["newRole"].(model.TeamMemberRole)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_changeUserRoleInTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_changeUserRoleInTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeUserFromTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeUserFromTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveUserFromTeamByAdmin(rctx, fc.Args["userUid"].(string), fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeUserFromTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeUserFromTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_addUserToTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_addUserToTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().AddUserToTeamByAdmin(rctx, fc.Args["teamID"].(string), fc.Args["role"].(model.TeamMemberRole), fc.Args["userEmail"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_addUserToTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_addUserToTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_renameTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_renameTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RenameTeamByAdmin(rctx, fc.Args["teamID"].(string), fc.Args["newName"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_renameTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_renameTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteTeamByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteTeamByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteTeamByAdmin(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteTeamByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteTeamByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_revokeTeamInviteByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_revokeTeamInviteByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RevokeTeamInviteByAdmin(rctx, fc.Args["inviteID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_revokeTeamInviteByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_revokeTeamInviteByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_revokeShortcodeByAdmin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_revokeShortcodeByAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RevokeShortcodeByAdmin(rctx, fc.Args["code"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_revokeShortcodeByAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_revokeShortcodeByAdmin_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateTeam(rctx, fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_leaveTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_leaveTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().LeaveTeam(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_leaveTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_leaveTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeTeamMember(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeTeamMember(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveTeamMember(rctx, fc.Args["teamID"].(string), fc.Args["userUid"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeTeamMember(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeTeamMember_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_renameTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_renameTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RenameTeam(rctx, fc.Args["teamID"].(string), fc.Args["newName"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_renameTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_renameTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteTeam(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateTeamMemberRole(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateTeamMemberRole(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateTeamMemberRole(rctx, fc.Args["teamID"].(string), fc.Args["userUid"].(string), fc.Args["newRole"].(model.TeamMemberRole)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateTeamMemberRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateTeamMemberRole_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createTeamInvitation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTeamInvitation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateTeamInvitation(rctx, fc.Args["teamID"].(string), fc.Args["inviteeEmail"].(string), fc.Args["inviteeRole"].(model.TeamMemberRole)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamInvitation) + fc.Result = res + return ec.marshalNTeamInvitation2ᚖmodelᚐTeamInvitation(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createTeamInvitation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createTeamInvitation_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_revokeTeamInvitation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_revokeTeamInvitation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RevokeTeamInvitation(rctx, fc.Args["inviteID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_revokeTeamInvitation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_revokeTeamInvitation_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_acceptTeamInvitation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_acceptTeamInvitation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().AcceptTeamInvitation(rctx, fc.Args["inviteID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_acceptTeamInvitation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_acceptTeamInvitation_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createTeamEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createTeamEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateTeamEnvironment(rctx, fc.Args["name"].(string), fc.Args["teamID"].(string), fc.Args["variables"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamEnvironment) + fc.Result = res + return ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createTeamEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createTeamEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteTeamEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteTeamEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteTeamEnvironment(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteTeamEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteTeamEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateTeamEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateTeamEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateTeamEnvironment(rctx, fc.Args["id"].(string), fc.Args["name"].(string), fc.Args["variables"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamEnvironment) + fc.Result = res + return ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateTeamEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateTeamEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteAllVariablesFromTeamEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteAllVariablesFromTeamEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteAllVariablesFromTeamEnvironment(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamEnvironment) + fc.Result = res + return ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteAllVariablesFromTeamEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteAllVariablesFromTeamEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createDuplicateEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDuplicateEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDuplicateEnvironment(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamEnvironment) + fc.Result = res + return ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDuplicateEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createDuplicateEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRootCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRootCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRootCollection(rctx, fc.Args["teamID"].(string), fc.Args["title"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRootCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createRootCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_importCollectionsFromJSON(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_importCollectionsFromJSON(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ImportCollectionsFromJSON(rctx, fc.Args["teamID"].(string), fc.Args["jsonString"].(string), fc.Args["parentCollectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_importCollectionsFromJSON(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_importCollectionsFromJSON_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_replaceCollectionsWithJSON(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_replaceCollectionsWithJSON(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ReplaceCollectionsWithJSON(rctx, fc.Args["teamID"].(string), fc.Args["jsonString"].(string), fc.Args["parentCollectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_replaceCollectionsWithJSON(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_replaceCollectionsWithJSON_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createChildCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createChildCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateChildCollection(rctx, fc.Args["collectionID"].(string), fc.Args["childTitle"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createChildCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createChildCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_renameCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_renameCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RenameCollection(rctx, fc.Args["collectionID"].(string), fc.Args["newTitle"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_renameCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_renameCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteCollection(rctx, fc.Args["collectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_moveCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_moveCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MoveCollection(rctx, fc.Args["parentCollectionID"].(*string), fc.Args["collectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_moveCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_moveCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateCollectionOrder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateCollectionOrder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateCollectionOrder(rctx, fc.Args["collectionID"].(string), fc.Args["destCollID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateCollectionOrder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateCollectionOrder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateTeamCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateTeamCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateTeamCollection(rctx, fc.Args["collectionID"].(string), fc.Args["newTitle"].(*string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateTeamCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateTeamCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRequestInCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRequestInCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRequestInCollection(rctx, fc.Args["collectionID"].(string), fc.Args["data"].(dto.CreateTeamRequestInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRequestInCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createRequestInCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateRequest(rctx, fc.Args["requestID"].(string), fc.Args["data"].(dto.UpdateTeamRequestInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteRequest(rctx, fc.Args["requestID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateLookUpRequestOrder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateLookUpRequestOrder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateLookUpRequestOrder(rctx, fc.Args["collectionID"].(string), fc.Args["nextRequestID"].(*string), fc.Args["requestID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateLookUpRequestOrder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateLookUpRequestOrder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_moveRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_moveRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MoveRequest(rctx, fc.Args["srcCollID"].(*string), fc.Args["requestID"].(string), fc.Args["destCollID"].(string), fc.Args["nextRequestID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_moveRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_moveRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createShortcode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createShortcode(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateShortcode(rctx, fc.Args["request"].(string), fc.Args["properties"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Shortcode) + fc.Result = res + return ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createShortcode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createShortcode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateEmbedProperties(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateEmbedProperties(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateEmbedProperties(rctx, fc.Args["code"].(string), fc.Args["properties"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.Shortcode) + fc.Result = res + return ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateEmbedProperties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateEmbedProperties_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_revokeShortcode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_revokeShortcode(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RevokeShortcode(rctx, fc.Args["code"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_revokeShortcode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_revokeShortcode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createUserSettings(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createUserSettings(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUserSettings(rctx, fc.Args["properties"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserSetting) + fc.Result = res + return ec.marshalNUserSettings2ᚖmodelᚐUserSetting(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createUserSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserSettings_id(ctx, field) + case "userUid": + return ec.fieldContext_UserSettings_userUid(ctx, field) + case "properties": + return ec.fieldContext_UserSettings_properties(ctx, field) + case "updatedOn": + return ec.fieldContext_UserSettings_updatedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserSettings", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createUserSettings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUserSettings(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUserSettings(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUserSettings(rctx, fc.Args["properties"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserSetting) + fc.Result = res + return ec.marshalNUserSettings2ᚖmodelᚐUserSetting(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUserSettings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserSettings_id(ctx, field) + case "userUid": + return ec.fieldContext_UserSettings_userUid(ctx, field) + case "properties": + return ec.fieldContext_UserSettings_properties(ctx, field) + case "updatedOn": + return ec.fieldContext_UserSettings_updatedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserSettings", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateUserSettings_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createUserEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createUserEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUserEnvironment(rctx, fc.Args["name"].(string), fc.Args["variables"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createUserEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createUserEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createUserGlobalEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createUserGlobalEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUserGlobalEnvironment(rctx, fc.Args["variables"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createUserGlobalEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createUserGlobalEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUserEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUserEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUserEnvironment(rctx, fc.Args["id"].(string), fc.Args["name"].(string), fc.Args["variables"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUserEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateUserEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUserEnvironment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUserEnvironment(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUserEnvironment(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUserEnvironment(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteUserEnvironment_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUserEnvironments(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUserEnvironments(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUserEnvironments(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUserEnvironments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Mutation_clearGlobalEnvironments(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_clearGlobalEnvironments(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ClearGlobalEnvironments(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_clearGlobalEnvironments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_clearGlobalEnvironments_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createUserHistory(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createUserHistory(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateUserHistory(rctx, fc.Args["reqData"].(string), fc.Args["resMetadata"].(string), fc.Args["reqType"].(model.ReqType)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserHistory) + fc.Result = res + return ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createUserHistory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createUserHistory_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_toggleHistoryStarStatus(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_toggleHistoryStarStatus(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ToggleHistoryStarStatus(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserHistory) + fc.Result = res + return ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_toggleHistoryStarStatus(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_toggleHistoryStarStatus_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeRequestFromHistory(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeRequestFromHistory(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveRequestFromHistory(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserHistory) + fc.Result = res + return ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeRequestFromHistory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeRequestFromHistory_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteAllUserHistory(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteAllUserHistory(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteAllUserHistory(rctx, fc.Args["reqType"].(model.ReqType)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*dto.UserHistoryDeletedManyData) + fc.Result = res + return ec.marshalNUserHistoryDeletedManyData2ᚖdtoᚐUserHistoryDeletedManyData(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteAllUserHistory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "count": + return ec.fieldContext_UserHistoryDeletedManyData_count(ctx, field) + case "reqType": + return ec.fieldContext_UserHistoryDeletedManyData_reqType(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistoryDeletedManyData", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteAllUserHistory_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRESTUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRESTUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRESTUserRequest(rctx, fc.Args["collectionID"].(string), fc.Args["title"].(string), fc.Args["request"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRESTUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createRESTUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createGQLUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createGQLUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateGQLUserRequest(rctx, fc.Args["collectionID"].(string), fc.Args["title"].(string), fc.Args["request"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createGQLUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createGQLUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateRESTUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateRESTUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateRESTUserRequest(rctx, fc.Args["id"].(string), fc.Args["title"].(*string), fc.Args["request"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateRESTUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateRESTUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateGQLUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateGQLUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateGQLUserRequest(rctx, fc.Args["id"].(string), fc.Args["title"].(*string), fc.Args["request"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateGQLUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateGQLUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUserRequest(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_moveUserRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_moveUserRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MoveUserRequest(rctx, fc.Args["sourceCollectionID"].(string), fc.Args["requestID"].(string), fc.Args["destinationCollectionID"].(string), fc.Args["nextRequestID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_moveUserRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_moveUserRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRESTRootUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRESTRootUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRESTRootUserCollection(rctx, fc.Args["title"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRESTRootUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createRESTRootUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createGQLRootUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createGQLRootUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateGQLRootUserCollection(rctx, fc.Args["title"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createGQLRootUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createGQLRootUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createGQLChildUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createGQLChildUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateGQLChildUserCollection(rctx, fc.Args["title"].(string), fc.Args["parentUserCollectionID"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createGQLChildUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createGQLChildUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_createRESTChildUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createRESTChildUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateRESTChildUserCollection(rctx, fc.Args["title"].(string), fc.Args["parentUserCollectionID"].(string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createRESTChildUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createRESTChildUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_renameUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_renameUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RenameUserCollection(rctx, fc.Args["userCollectionID"].(string), fc.Args["newTitle"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_renameUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_renameUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteUserCollection(rctx, fc.Args["userCollectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_moveUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_moveUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MoveUserCollection(rctx, fc.Args["destCollectionID"].(*string), fc.Args["userCollectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_moveUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_moveUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUserCollectionOrder(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUserCollectionOrder(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUserCollectionOrder(rctx, fc.Args["collectionID"].(string), fc.Args["nextCollectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUserCollectionOrder(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateUserCollectionOrder_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_importUserCollectionsFromJSON(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_importUserCollectionsFromJSON(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().ImportUserCollectionsFromJSON(rctx, fc.Args["jsonString"].(string), fc.Args["reqType"].(model.ReqType), fc.Args["parentCollectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_importUserCollectionsFromJSON(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_importUserCollectionsFromJSON_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateUserCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateUserCollection(rctx, fc.Args["userCollectionID"].(string), fc.Args["newTitle"].(*string), fc.Args["data"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateUserCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_me(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_me(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Me(rctx) + } + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.IsLogin == nil { + return nil, errors.New("directive isLogin is not implemented") + } + return ec.directives.IsLogin(ctx, nil, directive0) + } + + tmp, err := directive1(rctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if tmp == nil { + return nil, nil + } + if data, ok := tmp.(*model.User); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be *model.User`, tmp) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.User) + fc.Result = res + return ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_me(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_infra(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_infra(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Infra(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*dto.Infra) + fc.Result = res + return ec.marshalNInfra2ᚖdtoᚐInfra(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_infra(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "executedBy": + return ec.fieldContext_Infra_executedBy(ctx, field) + case "admins": + return ec.fieldContext_Infra_admins(ctx, field) + case "userInfo": + return ec.fieldContext_Infra_userInfo(ctx, field) + case "allUsers": + return ec.fieldContext_Infra_allUsers(ctx, field) + case "invitedUsers": + return ec.fieldContext_Infra_invitedUsers(ctx, field) + case "allTeams": + return ec.fieldContext_Infra_allTeams(ctx, field) + case "teamInfo": + return ec.fieldContext_Infra_teamInfo(ctx, field) + case "membersCountInTeam": + return ec.fieldContext_Infra_membersCountInTeam(ctx, field) + case "collectionCountInTeam": + return ec.fieldContext_Infra_collectionCountInTeam(ctx, field) + case "requestCountInTeam": + return ec.fieldContext_Infra_requestCountInTeam(ctx, field) + case "environmentCountInTeam": + return ec.fieldContext_Infra_environmentCountInTeam(ctx, field) + case "pendingInvitationCountInTeam": + return ec.fieldContext_Infra_pendingInvitationCountInTeam(ctx, field) + case "usersCount": + return ec.fieldContext_Infra_usersCount(ctx, field) + case "teamsCount": + return ec.fieldContext_Infra_teamsCount(ctx, field) + case "teamCollectionsCount": + return ec.fieldContext_Infra_teamCollectionsCount(ctx, field) + case "teamRequestsCount": + return ec.fieldContext_Infra_teamRequestsCount(ctx, field) + case "allShortcodes": + return ec.fieldContext_Infra_allShortcodes(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Infra", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_infraConfigs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_infraConfigs(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().InfraConfigs(rctx, fc.Args["configNames"].([]dto.InfraConfigEnum)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.InfraConfig) + fc.Result = res + return ec.marshalNInfraConfig2ᚕᚖmodelᚐInfraConfigᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_infraConfigs(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext_InfraConfig_name(ctx, field) + case "value": + return ec.fieldContext_InfraConfig_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InfraConfig", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_infraConfigs_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_allowedAuthProviders(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_allowedAuthProviders(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().AllowedAuthProviders(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalNString2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_allowedAuthProviders(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_admin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_admin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Admin(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*dto.Admin) + fc.Result = res + return ec.marshalNAdmin2ᚖdtoᚐAdmin(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_admin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_Admin_uid(ctx, field) + case "displayName": + return ec.fieldContext_Admin_displayName(ctx, field) + case "email": + return ec.fieldContext_Admin_email(ctx, field) + case "photoURL": + return ec.fieldContext_Admin_photoURL(ctx, field) + case "createdOn": + return ec.fieldContext_Admin_createdOn(ctx, field) + case "admins": + return ec.fieldContext_Admin_admins(ctx, field) + case "userInfo": + return ec.fieldContext_Admin_userInfo(ctx, field) + case "allUsers": + return ec.fieldContext_Admin_allUsers(ctx, field) + case "invitedUsers": + return ec.fieldContext_Admin_invitedUsers(ctx, field) + case "allTeams": + return ec.fieldContext_Admin_allTeams(ctx, field) + case "teamInfo": + return ec.fieldContext_Admin_teamInfo(ctx, field) + case "membersCountInTeam": + return ec.fieldContext_Admin_membersCountInTeam(ctx, field) + case "collectionCountInTeam": + return ec.fieldContext_Admin_collectionCountInTeam(ctx, field) + case "requestCountInTeam": + return ec.fieldContext_Admin_requestCountInTeam(ctx, field) + case "environmentCountInTeam": + return ec.fieldContext_Admin_environmentCountInTeam(ctx, field) + case "pendingInvitationCountInTeam": + return ec.fieldContext_Admin_pendingInvitationCountInTeam(ctx, field) + case "usersCount": + return ec.fieldContext_Admin_usersCount(ctx, field) + case "teamsCount": + return ec.fieldContext_Admin_teamsCount(ctx, field) + case "teamCollectionsCount": + return ec.fieldContext_Admin_teamCollectionsCount(ctx, field) + case "teamRequestsCount": + return ec.fieldContext_Admin_teamRequestsCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Admin", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Query_myTeams(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_myTeams(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().MyTeams(rctx, fc.Args["cursor"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Team) + fc.Result = res + return ec.marshalNTeam2ᚕᚖmodelᚐTeamᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_myTeams(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_myTeams_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_team(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_team(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Team(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Team) + fc.Result = res + return ec.marshalOTeam2ᚖmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_team_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_teamInvitation(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_teamInvitation(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().TeamInvitation(rctx, fc.Args["inviteID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamInvitation) + fc.Result = res + return ec.marshalNTeamInvitation2ᚖmodelᚐTeamInvitation(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_teamInvitation(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_teamInvitation_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_exportCollectionsToJSON(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_exportCollectionsToJSON(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ExportCollectionsToJSON(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_exportCollectionsToJSON(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_exportCollectionsToJSON_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_rootCollectionsOfTeam(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_rootCollectionsOfTeam(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().RootCollectionsOfTeam(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int), fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚕᚖmodelᚐTeamCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_rootCollectionsOfTeam(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_rootCollectionsOfTeam_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_collection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_collection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Collection(rctx, fc.Args["collectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalOTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_collection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_collection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_searchForRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_searchForRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().SearchForRequest(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int), fc.Args["teamID"].(string), fc.Args["searchTerm"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚕᚖmodelᚐTeamRequestᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_searchForRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_searchForRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_request(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Request(rctx, fc.Args["requestID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalOTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_request_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_requestsInCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_requestsInCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().RequestsInCollection(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int), fc.Args["collectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚕᚖmodelᚐTeamRequestᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_requestsInCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_requestsInCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_shortcode(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_shortcode(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().Shortcode(rctx, fc.Args["code"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.Shortcode) + fc.Result = res + return ec.marshalOShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_shortcode(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_shortcode_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_myShortcodes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_myShortcodes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().MyShortcodes(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.Shortcode) + fc.Result = res + return ec.marshalNShortcode2ᚕᚖmodelᚐShortcodeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_myShortcodes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_myShortcodes_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_userRESTRequests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_userRESTRequests(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().UserRESTRequests(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int), fc.Args["collectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚕᚖmodelᚐUserRequestᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_userRESTRequests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_userRESTRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_userGQLRequests(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_userGQLRequests(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().UserGQLRequests(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int), fc.Args["collectionID"].(*string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚕᚖmodelᚐUserRequestᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_userGQLRequests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_userGQLRequests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_userRequest(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_userRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().UserRequest(rctx, fc.Args["id"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_userRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_userRequest_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_rootRESTUserCollections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_rootRESTUserCollections(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().RootRESTUserCollections(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚕᚖmodelᚐUserCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_rootRESTUserCollections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_rootRESTUserCollections_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_rootGQLUserCollections(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_rootGQLUserCollections(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().RootGQLUserCollections(rctx, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚕᚖmodelᚐUserCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_rootGQLUserCollections(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_rootGQLUserCollections_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_userCollection(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_userCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().UserCollection(rctx, fc.Args["userCollectionID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_userCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_userCollection_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_exportUserCollectionsToJSON(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_exportUserCollectionsToJSON(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().ExportUserCollectionsToJSON(rctx, fc.Args["collectionID"].(*string), fc.Args["collectionType"].(model.ReqType)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*dto.UserCollectionExportJSONData) + fc.Result = res + return ec.marshalNUserCollectionExportJSONData2ᚖdtoᚐUserCollectionExportJSONData(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_exportUserCollectionsToJSON(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "exportedCollection": + return ec.fieldContext_UserCollectionExportJSONData_exportedCollection(ctx, field) + case "collectionType": + return ec.fieldContext_UserCollectionExportJSONData_collectionType(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollectionExportJSONData", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_exportUserCollectionsToJSON_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectType(fc.Args["name"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query___schema(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.introspectSchema() + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Schema) + fc.Result = res + return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query___schema(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "description": + return ec.fieldContext___Schema_description(ctx, field) + case "types": + return ec.fieldContext___Schema_types(ctx, field) + case "queryType": + return ec.fieldContext___Schema_queryType(ctx, field) + case "mutationType": + return ec.fieldContext___Schema_mutationType(ctx, field) + case "subscriptionType": + return ec.fieldContext___Schema_subscriptionType(ctx, field) + case "directives": + return ec.fieldContext___Schema_directives(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _RequestReorderData_request(ctx context.Context, field graphql.CollectedField, obj *dto.RequestReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RequestReorderData_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RequestReorderData_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RequestReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _RequestReorderData_nextRequest(ctx context.Context, field graphql.CollectedField, obj *dto.RequestReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RequestReorderData_nextRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NextRequest, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamRequest) + fc.Result = res + return ec.marshalOTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RequestReorderData_nextRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RequestReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Shortcode_id(ctx context.Context, field graphql.CollectedField, obj *model.Shortcode) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Shortcode_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Shortcode_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Shortcode", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Shortcode_request(ctx context.Context, field graphql.CollectedField, obj *model.Shortcode) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Shortcode_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Shortcode_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Shortcode", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Shortcode_properties(ctx context.Context, field graphql.CollectedField, obj *model.Shortcode) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Shortcode_properties(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EmbedProperties, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Shortcode_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Shortcode", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Shortcode_createdOn(ctx context.Context, field graphql.CollectedField, obj *model.Shortcode) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Shortcode_createdOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Shortcode_createdOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Shortcode", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeCreator_uid(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeCreator) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeCreator_uid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeCreator_uid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeCreator", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeCreator_email(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeCreator) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeCreator_email(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeCreator_email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeCreator", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeWithUserEmail_id(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeWithUserEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeWithUserEmail_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeWithUserEmail_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeWithUserEmail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeWithUserEmail_request(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeWithUserEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeWithUserEmail_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeWithUserEmail_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeWithUserEmail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeWithUserEmail_properties(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeWithUserEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeWithUserEmail_properties(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Properties, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeWithUserEmail_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeWithUserEmail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeWithUserEmail_createdOn(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeWithUserEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeWithUserEmail_createdOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeWithUserEmail_createdOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeWithUserEmail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _ShortcodeWithUserEmail_creator(ctx context.Context, field graphql.CollectedField, obj *dto.ShortcodeWithUserEmail) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_ShortcodeWithUserEmail_creator(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Creator, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*dto.ShortcodeCreator) + fc.Result = res + return ec.marshalOShortcodeCreator2ᚖdtoᚐShortcodeCreator(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_ShortcodeWithUserEmail_creator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ShortcodeWithUserEmail", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_ShortcodeCreator_uid(ctx, field) + case "email": + return ec.fieldContext_ShortcodeCreator_email(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ShortcodeCreator", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.User): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserDeleted(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.User): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUser2ᚖmodelᚐUser(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userInvited(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userInvited(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserInvited(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.InvitedUser): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNInvitedUser2ᚖmodelᚐInvitedUser(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userInvited(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "adminUid": + return ec.fieldContext_InvitedUser_adminUid(ctx, field) + case "adminEmail": + return ec.fieldContext_InvitedUser_adminEmail(ctx, field) + case "inviteeEmail": + return ec.fieldContext_InvitedUser_inviteeEmail(ctx, field) + case "invitedOn": + return ec.fieldContext_InvitedUser_invitedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InvitedUser", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamMemberAdded(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamMemberAdded(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamMemberAdded(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamMember): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamMemberAdded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamMemberAdded_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamMemberUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamMemberUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamMemberUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamMember): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamMemberUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamMemberUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamMemberRemoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamMemberRemoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamMemberRemoved(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNID2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamMemberRemoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamMemberRemoved_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamInvitationAdded(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamInvitationAdded(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamInvitationAdded(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamInvitation): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamInvitation2ᚖmodelᚐTeamInvitation(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamInvitationAdded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamInvitationAdded_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamInvitationRemoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamInvitationRemoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamInvitationRemoved(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNID2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamInvitationRemoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamInvitationRemoved_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamEnvironmentUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamEnvironmentUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamEnvironmentUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamEnvironmentUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamEnvironmentUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamEnvironmentCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamEnvironmentCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamEnvironmentCreated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamEnvironmentCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamEnvironmentCreated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamEnvironmentDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamEnvironmentDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamEnvironmentDeleted(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamEnvironmentDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamEnvironmentDeleted_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamCollectionAdded(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamCollectionAdded(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamCollectionAdded(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamCollectionAdded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamCollectionAdded_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamCollectionUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamCollectionUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamCollectionUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamCollectionUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamCollectionUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamCollectionRemoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamCollectionRemoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamCollectionRemoved(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNID2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamCollectionRemoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamCollectionRemoved_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamCollectionMoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamCollectionMoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamCollectionMoved(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamCollectionMoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamCollectionMoved_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_collectionOrderUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_collectionOrderUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().CollectionOrderUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.CollectionReorderData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNCollectionReorderData2ᚖdtoᚐCollectionReorderData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_collectionOrderUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "collection": + return ec.fieldContext_CollectionReorderData_collection(ctx, field) + case "nextCollection": + return ec.fieldContext_CollectionReorderData_nextCollection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CollectionReorderData", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_collectionOrderUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamRequestAdded(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamRequestAdded(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamRequestAdded(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamRequestAdded(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamRequestAdded_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamRequestUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamRequestUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamRequestUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamRequestUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamRequestUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_teamRequestDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_teamRequestDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().TeamRequestDeleted(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan string): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNID2string(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_teamRequestDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_teamRequestDeleted_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_requestOrderUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_requestOrderUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().RequestOrderUpdated(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.RequestReorderData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNRequestReorderData2ᚖdtoᚐRequestReorderData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_requestOrderUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "request": + return ec.fieldContext_RequestReorderData_request(ctx, field) + case "nextRequest": + return ec.fieldContext_RequestReorderData_nextRequest(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RequestReorderData", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_requestOrderUpdated_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_requestMoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_requestMoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().RequestMoved(rctx, fc.Args["teamID"].(string)) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.TeamRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_requestMoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_TeamRequest_collectionID(ctx, field) + case "teamID": + return ec.fieldContext_TeamRequest_teamID(ctx, field) + case "request": + return ec.fieldContext_TeamRequest_request(ctx, field) + case "title": + return ec.fieldContext_TeamRequest_title(ctx, field) + case "team": + return ec.fieldContext_TeamRequest_team(ctx, field) + case "collection": + return ec.fieldContext_TeamRequest_collection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Subscription_requestMoved_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Subscription_myShortcodesCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_myShortcodesCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().MyShortcodesCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.Shortcode): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_myShortcodesCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_myShortcodesUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_myShortcodesUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().MyShortcodesUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.Shortcode): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_myShortcodesUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_myShortcodesRevoked(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_myShortcodesRevoked(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().MyShortcodesRevoked(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.Shortcode): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_myShortcodesRevoked(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Shortcode_id(ctx, field) + case "request": + return ec.fieldContext_Shortcode_request(ctx, field) + case "properties": + return ec.fieldContext_Shortcode_properties(ctx, field) + case "createdOn": + return ec.fieldContext_Shortcode_createdOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Shortcode", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userSettingsCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userSettingsCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserSettingsCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserSetting): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserSettings2ᚖmodelᚐUserSetting(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userSettingsCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserSettings_id(ctx, field) + case "userUid": + return ec.fieldContext_UserSettings_userUid(ctx, field) + case "properties": + return ec.fieldContext_UserSettings_properties(ctx, field) + case "updatedOn": + return ec.fieldContext_UserSettings_updatedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserSettings", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userSettingsUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userSettingsUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserSettingsUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserSetting): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserSettings2ᚖmodelᚐUserSetting(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userSettingsUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserSettings_id(ctx, field) + case "userUid": + return ec.fieldContext_UserSettings_userUid(ctx, field) + case "properties": + return ec.fieldContext_UserSettings_properties(ctx, field) + case "updatedOn": + return ec.fieldContext_UserSettings_updatedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserSettings", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userEnvironmentCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userEnvironmentCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserEnvironmentCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userEnvironmentCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userEnvironmentUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userEnvironmentUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserEnvironmentUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userEnvironmentUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userEnvironmentDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userEnvironmentDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserEnvironmentDeleted(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserEnvironment): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userEnvironmentDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userEnvironmentDeleteMany(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userEnvironmentDeleteMany(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserEnvironmentDeleteMany(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan int): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNInt2int(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userEnvironmentDeleteMany(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userHistoryCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userHistoryCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserHistoryCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserHistory): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userHistoryCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userHistoryUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userHistoryUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserHistoryUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserHistory): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userHistoryUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userHistoryDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userHistoryDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserHistoryDeleted(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserHistory): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userHistoryDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userHistoryDeletedMany(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userHistoryDeletedMany(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserHistoryDeletedMany(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.UserHistoryDeletedManyData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserHistoryDeletedManyData2ᚖdtoᚐUserHistoryDeletedManyData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userHistoryDeletedMany(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "count": + return ec.fieldContext_UserHistoryDeletedManyData_count(ctx, field) + case "reqType": + return ec.fieldContext_UserHistoryDeletedManyData_reqType(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistoryDeletedManyData", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userRequestCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userRequestCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserRequestCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userRequestCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userRequestUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userRequestUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserRequestUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userRequestUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userRequestDeleted(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userRequestDeleted(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserRequestDeleted(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserRequest): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userRequestDeleted(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userRequestMoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userRequestMoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserRequestMoved(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.UserRequestReorderData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserRequestReorderData2ᚖdtoᚐUserRequestReorderData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userRequestMoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "request": + return ec.fieldContext_UserRequestReorderData_request(ctx, field) + case "nextRequest": + return ec.fieldContext_UserRequestReorderData_nextRequest(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequestReorderData", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userCollectionCreated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userCollectionCreated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCollectionCreated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userCollectionCreated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userCollectionUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userCollectionUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCollectionUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userCollectionUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userCollectionRemoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userCollectionRemoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCollectionRemoved(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.UserCollectionRemovedData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserCollectionRemovedData2ᚖdtoᚐUserCollectionRemovedData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userCollectionRemoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollectionRemovedData_id(ctx, field) + case "type": + return ec.fieldContext_UserCollectionRemovedData_type(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollectionRemovedData", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userCollectionMoved(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userCollectionMoved(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCollectionMoved(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *model.UserCollection): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userCollectionMoved(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Subscription_userCollectionOrderUpdated(ctx context.Context, field graphql.CollectedField) (ret func(ctx context.Context) graphql.Marshaler) { + fc, err := ec.fieldContext_Subscription_userCollectionOrderUpdated(ctx, field) + if err != nil { + return nil + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Subscription().UserCollectionOrderUpdated(rctx) + }) + if err != nil { + ec.Error(ctx, err) + return nil + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return nil + } + return func(ctx context.Context) graphql.Marshaler { + select { + case res, ok := <-resTmp.(<-chan *dto.UserCollectionReorderData): + if !ok { + return nil + } + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte{'{'}) + graphql.MarshalString(field.Alias).MarshalGQL(w) + w.Write([]byte{':'}) + ec.marshalNUserCollectionReorderData2ᚖdtoᚐUserCollectionReorderData(ctx, field.Selections, res).MarshalGQL(w) + w.Write([]byte{'}'}) + }) + case <-ctx.Done(): + return nil + } + } +} + +func (ec *executionContext) fieldContext_Subscription_userCollectionOrderUpdated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Subscription", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userCollection": + return ec.fieldContext_UserCollectionReorderData_userCollection(ctx, field) + case "nextUserCollection": + return ec.fieldContext_UserCollectionReorderData_nextUserCollection(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollectionReorderData", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_id(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_name(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_members(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_members(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Members, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚕmodelᚐTeamMemberᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_members(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Team_members_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Team_teamMembers(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_teamMembers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().TeamMembers(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamMember) + fc.Result = res + return ec.marshalNTeamMember2ᚕᚖmodelᚐTeamMemberᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_teamMembers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "membershipID": + return ec.fieldContext_TeamMember_membershipID(ctx, field) + case "role": + return ec.fieldContext_TeamMember_role(ctx, field) + case "user": + return ec.fieldContext_TeamMember_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamMember", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_myRole(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_myRole(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().MyRole(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamMemberRole) + fc.Result = res + return ec.marshalOTeamMemberRole2ᚖmodelᚐTeamMemberRole(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_myRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TeamMemberRole does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_ownersCount(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_ownersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().OwnersCount(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_ownersCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_editorsCount(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_editorsCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().EditorsCount(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_editorsCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_viewersCount(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_viewersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().ViewersCount(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_viewersCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_teamInvitations(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_teamInvitations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().TeamInvitations(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamInvitation) + fc.Result = res + return ec.marshalNTeamInvitation2ᚕᚖmodelᚐTeamInvitationᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_teamInvitations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamInvitation_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamInvitation_teamID(ctx, field) + case "creatorUid": + return ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + case "inviteeEmail": + return ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + case "inviteeRole": + return ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + case "team": + return ec.fieldContext_TeamInvitation_team(ctx, field) + case "creator": + return ec.fieldContext_TeamInvitation_creator(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamInvitation", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Team_teamEnvironments(ctx context.Context, field graphql.CollectedField, obj *model.Team) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Team_teamEnvironments(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Team().TeamEnvironments(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.TeamEnvironment) + fc.Result = res + return ec.marshalNTeamEnvironment2ᚕᚖmodelᚐTeamEnvironmentᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Team_teamEnvironments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Team", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamEnvironment_id(ctx, field) + case "teamID": + return ec.fieldContext_TeamEnvironment_teamID(ctx, field) + case "name": + return ec.fieldContext_TeamEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_TeamEnvironment_variables(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_id(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_title(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_data(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_data(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Data, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_parentID(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_parentID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ParentID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_parentID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_team(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_team(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Team, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.Team) + fc.Result = res + return ec.marshalNTeam2modelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_parent(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_parent(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Parent, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.TeamCollection) + fc.Result = res + return ec.marshalOTeamCollection2ᚖmodelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_parent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamCollection_children(ctx context.Context, field graphql.CollectedField, obj *model.TeamCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamCollection_children(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Children, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2ᚕmodelᚐTeamCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamCollection_children(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_TeamCollection_children_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _TeamEnvironment_id(ctx context.Context, field graphql.CollectedField, obj *model.TeamEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamEnvironment_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamEnvironment_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamEnvironment_teamID(ctx context.Context, field graphql.CollectedField, obj *model.TeamEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamEnvironment_teamID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamEnvironment_teamID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamEnvironment_name(ctx context.Context, field graphql.CollectedField, obj *model.TeamEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamEnvironment_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamEnvironment_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamEnvironment_variables(ctx context.Context, field graphql.CollectedField, obj *model.TeamEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamEnvironment_variables(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Variables, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamEnvironment_variables(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_id(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_teamID(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_teamID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_teamID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_creatorUid(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_creatorUid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatorUID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_creatorUid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_inviteeEmail(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_inviteeEmail(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InviteeEmail, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_inviteeEmail(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_inviteeRole(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_inviteeRole(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InviteeRole, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.TeamMemberRole) + fc.Result = res + return ec.marshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_inviteeRole(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TeamMemberRole does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_team(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_team(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Team, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.Team) + fc.Result = res + return ec.marshalNTeam2modelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamInvitation_creator(ctx context.Context, field graphql.CollectedField, obj *model.TeamInvitation) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamInvitation_creator(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Creator, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.User) + fc.Result = res + return ec.marshalNUser2modelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamInvitation_creator(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamInvitation", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamMember_membershipID(ctx context.Context, field graphql.CollectedField, obj *model.TeamMember) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamMember_membershipID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamMember_membershipID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamMember", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamMember_role(ctx context.Context, field graphql.CollectedField, obj *model.TeamMember) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamMember_role(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Role, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.TeamMemberRole) + fc.Result = res + return ec.marshalNTeamMemberRole2modelᚐTeamMemberRole(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamMember_role(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamMember", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type TeamMemberRole does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamMember_user(ctx context.Context, field graphql.CollectedField, obj *model.TeamMember) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamMember_user(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.User, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.User) + fc.Result = res + return ec.marshalNUser2modelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamMember_user(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamMember", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_id(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_collectionID(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_collectionID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CollectionID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_collectionID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_teamID(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_teamID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.TeamID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_teamID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_request(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_title(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_team(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_team(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Team, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.Team) + fc.Result = res + return ec.marshalNTeam2modelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "teamMembers": + return ec.fieldContext_Team_teamMembers(ctx, field) + case "myRole": + return ec.fieldContext_Team_myRole(ctx, field) + case "ownersCount": + return ec.fieldContext_Team_ownersCount(ctx, field) + case "editorsCount": + return ec.fieldContext_Team_editorsCount(ctx, field) + case "viewersCount": + return ec.fieldContext_Team_viewersCount(ctx, field) + case "teamInvitations": + return ec.fieldContext_Team_teamInvitations(ctx, field) + case "teamEnvironments": + return ec.fieldContext_Team_teamEnvironments(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _TeamRequest_collection(ctx context.Context, field graphql.CollectedField, obj *model.TeamRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_TeamRequest_collection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Collection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.TeamCollection) + fc.Result = res + return ec.marshalNTeamCollection2modelᚐTeamCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_TeamRequest_collection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "TeamRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_TeamCollection_id(ctx, field) + case "title": + return ec.fieldContext_TeamCollection_title(ctx, field) + case "data": + return ec.fieldContext_TeamCollection_data(ctx, field) + case "parentID": + return ec.fieldContext_TeamCollection_parentID(ctx, field) + case "team": + return ec.fieldContext_TeamCollection_team(ctx, field) + case "parent": + return ec.fieldContext_TeamCollection_parent(ctx, field) + case "children": + return ec.fieldContext_TeamCollection_children(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type TeamCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_uid(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_uid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_uid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_displayName(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_displayName(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DisplayName, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_displayName(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_email(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_email(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Email, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_email(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_photoURL(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_photoURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PhotoURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_photoURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_isAdmin(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_isAdmin(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsAdmin, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_isAdmin(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_createdOn(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_createdOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_createdOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_currentRESTSession(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_currentRESTSession(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CurrentRESTSession, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_currentRESTSession(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_currentGQLSession(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_currentGQLSession(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CurrentGQLSession, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_currentGQLSession(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_settings(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_settings(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Settings, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserSetting) + fc.Result = res + return ec.marshalNUserSettings2ᚖmodelᚐUserSetting(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_settings(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserSettings_id(ctx, field) + case "userUid": + return ec.fieldContext_UserSettings_userUid(ctx, field) + case "properties": + return ec.fieldContext_UserSettings_properties(ctx, field) + case "updatedOn": + return ec.fieldContext_UserSettings_updatedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserSettings", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_environments(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_environments(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Environments, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚕmodelᚐUserEnvironmentᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_environments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_globalEnvironments(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_globalEnvironments(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().GlobalEnvironments(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserEnvironment) + fc.Result = res + return ec.marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_globalEnvironments(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserEnvironment_id(ctx, field) + case "userUid": + return ec.fieldContext_UserEnvironment_userUid(ctx, field) + case "name": + return ec.fieldContext_UserEnvironment_name(ctx, field) + case "variables": + return ec.fieldContext_UserEnvironment_variables(ctx, field) + case "isGlobal": + return ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserEnvironment", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _User_RESTHistory(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_RESTHistory(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().RESTHistory(rctx, obj, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserHistory) + fc.Result = res + return ec.marshalNUserHistory2ᚕᚖmodelᚐUserHistoryᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_RESTHistory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_RESTHistory_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _User_GQLHistory(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_GQLHistory(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().GQLHistory(rctx, obj, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserHistory) + fc.Result = res + return ec.marshalNUserHistory2ᚕᚖmodelᚐUserHistoryᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_GQLHistory(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserHistory_id(ctx, field) + case "userUid": + return ec.fieldContext_UserHistory_userUid(ctx, field) + case "reqType": + return ec.fieldContext_UserHistory_reqType(ctx, field) + case "request": + return ec.fieldContext_UserHistory_request(ctx, field) + case "responseMetadata": + return ec.fieldContext_UserHistory_responseMetadata(ctx, field) + case "isStarred": + return ec.fieldContext_UserHistory_isStarred(ctx, field) + case "executedOn": + return ec.fieldContext_UserHistory_executedOn(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserHistory", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_GQLHistory_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_id(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_title(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_data(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_data(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Data, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_type(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_requests(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_requests(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Requests, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚕmodelᚐUserRequestᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_requests(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_UserCollection_requests_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_user(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_user(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.User, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.User) + fc.Result = res + return ec.marshalNUser2modelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_user(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_parent(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_parent(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Parent, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalOUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_parent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_childrenREST(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_childrenREST(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.UserCollection().ChildrenRest(rctx, obj, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚕᚖmodelᚐUserCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_childrenREST(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_UserCollection_childrenREST_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _UserCollection_childrenGQL(ctx context.Context, field graphql.CollectedField, obj *model.UserCollection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollection_childrenGQL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.UserCollection().ChildrenGql(rctx, obj, fc.Args["cursor"].(*string), fc.Args["take"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚕᚖmodelᚐUserCollectionᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollection_childrenGQL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollection", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_UserCollection_childrenGQL_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionExportJSONData_exportedCollection(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionExportJSONData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionExportJSONData_exportedCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExportedCollection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionExportJSONData_exportedCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionExportJSONData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionExportJSONData_collectionType(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionExportJSONData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionExportJSONData_collectionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CollectionType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionExportJSONData_collectionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionExportJSONData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionRemovedData_id(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionRemovedData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionRemovedData_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionRemovedData_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionRemovedData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionRemovedData_type(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionRemovedData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionRemovedData_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionRemovedData_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionRemovedData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionReorderData_userCollection(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionReorderData_userCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserCollection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionReorderData_userCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserCollectionReorderData_nextUserCollection(ctx context.Context, field graphql.CollectedField, obj *dto.UserCollectionReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserCollectionReorderData_nextUserCollection(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NextUserCollection, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.UserCollection) + fc.Result = res + return ec.marshalOUserCollection2ᚖmodelᚐUserCollection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserCollectionReorderData_nextUserCollection(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserCollectionReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserCollection_id(ctx, field) + case "title": + return ec.fieldContext_UserCollection_title(ctx, field) + case "data": + return ec.fieldContext_UserCollection_data(ctx, field) + case "type": + return ec.fieldContext_UserCollection_type(ctx, field) + case "requests": + return ec.fieldContext_UserCollection_requests(ctx, field) + case "user": + return ec.fieldContext_UserCollection_user(ctx, field) + case "parent": + return ec.fieldContext_UserCollection_parent(ctx, field) + case "childrenREST": + return ec.fieldContext_UserCollection_childrenREST(ctx, field) + case "childrenGQL": + return ec.fieldContext_UserCollection_childrenGQL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserCollection", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEnvironment_id(ctx context.Context, field graphql.CollectedField, obj *model.UserEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEnvironment_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserEnvironment_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEnvironment_userUid(ctx context.Context, field graphql.CollectedField, obj *model.UserEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEnvironment_userUid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserUID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserEnvironment_userUid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEnvironment_name(ctx context.Context, field graphql.CollectedField, obj *model.UserEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEnvironment_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserEnvironment_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEnvironment_variables(ctx context.Context, field graphql.CollectedField, obj *model.UserEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEnvironment_variables(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Variables, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserEnvironment_variables(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserEnvironment_isGlobal(ctx context.Context, field graphql.CollectedField, obj *model.UserEnvironment) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserEnvironment_isGlobal(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsGlobal, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserEnvironment_isGlobal(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserEnvironment", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_id(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_userUid(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_userUid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserUID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_userUid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_reqType(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_reqType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ReqType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_reqType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_request(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_responseMetadata(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_responseMetadata(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ResponseMetadata, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_responseMetadata(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_isStarred(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_isStarred(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsStarred, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_isStarred(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistory_executedOn(ctx context.Context, field graphql.CollectedField, obj *model.UserHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistory_executedOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExecutedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistory_executedOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistoryDeletedManyData_count(ctx context.Context, field graphql.CollectedField, obj *dto.UserHistoryDeletedManyData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistoryDeletedManyData_count(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Count, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistoryDeletedManyData_count(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistoryDeletedManyData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserHistoryDeletedManyData_reqType(ctx context.Context, field graphql.CollectedField, obj *dto.UserHistoryDeletedManyData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserHistoryDeletedManyData_reqType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ReqType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserHistoryDeletedManyData_reqType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserHistoryDeletedManyData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_id(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_collectionID(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_collectionID(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CollectionID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_collectionID(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_title(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_request(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_type(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.ReqType) + fc.Result = res + return ec.marshalNReqType2modelᚐReqType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ReqType does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_createdOn(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_createdOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_createdOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequest_user(ctx context.Context, field graphql.CollectedField, obj *model.UserRequest) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequest_user(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.User, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(model.User) + fc.Result = res + return ec.marshalNUser2modelᚐUser(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequest_user(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequest", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "uid": + return ec.fieldContext_User_uid(ctx, field) + case "displayName": + return ec.fieldContext_User_displayName(ctx, field) + case "email": + return ec.fieldContext_User_email(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "createdOn": + return ec.fieldContext_User_createdOn(ctx, field) + case "currentRESTSession": + return ec.fieldContext_User_currentRESTSession(ctx, field) + case "currentGQLSession": + return ec.fieldContext_User_currentGQLSession(ctx, field) + case "settings": + return ec.fieldContext_User_settings(ctx, field) + case "environments": + return ec.fieldContext_User_environments(ctx, field) + case "globalEnvironments": + return ec.fieldContext_User_globalEnvironments(ctx, field) + case "RESTHistory": + return ec.fieldContext_User_RESTHistory(ctx, field) + case "GQLHistory": + return ec.fieldContext_User_GQLHistory(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequestReorderData_request(ctx context.Context, field graphql.CollectedField, obj *dto.UserRequestReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequestReorderData_request(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Request, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequestReorderData_request(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequestReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserRequestReorderData_nextRequest(ctx context.Context, field graphql.CollectedField, obj *dto.UserRequestReorderData) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserRequestReorderData_nextRequest(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.NextRequest, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*model.UserRequest) + fc.Result = res + return ec.marshalOUserRequest2ᚖmodelᚐUserRequest(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserRequestReorderData_nextRequest(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserRequestReorderData", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_UserRequest_id(ctx, field) + case "collectionID": + return ec.fieldContext_UserRequest_collectionID(ctx, field) + case "title": + return ec.fieldContext_UserRequest_title(ctx, field) + case "request": + return ec.fieldContext_UserRequest_request(ctx, field) + case "type": + return ec.fieldContext_UserRequest_type(ctx, field) + case "createdOn": + return ec.fieldContext_UserRequest_createdOn(ctx, field) + case "user": + return ec.fieldContext_UserRequest_user(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UserRequest", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UserSettings_id(ctx context.Context, field graphql.CollectedField, obj *model.UserSetting) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserSettings_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserSettings_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserSettings", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserSettings_userUid(ctx context.Context, field graphql.CollectedField, obj *model.UserSetting) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserSettings_userUid(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserUID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNID2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserSettings_userUid(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserSettings", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserSettings_properties(ctx context.Context, field graphql.CollectedField, obj *model.UserSetting) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserSettings_properties(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Properties, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserSettings_properties(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserSettings", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UserSettings_updatedOn(ctx context.Context, field graphql.CollectedField, obj *model.UserSetting) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UserSettings_updatedOn(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedOn, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(time.Time) + fc.Result = res + return ec.marshalNDateTime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UserSettings_updatedOn(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UserSettings", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DateTime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_locations(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Locations, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]string) + fc.Result = res + return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_locations(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __DirectiveLocation does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRepeatable, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Directive", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__EnumValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_args(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Args, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_args(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsDeprecated(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_isDeprecated(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeprecationReason(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Field_deprecationReason(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Field", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_type(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Type, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.DefaultValue, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__InputValue", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_types(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Types(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_types(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_queryType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.QueryType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_queryType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_mutationType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.MutationType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_mutationType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SubscriptionType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Schema_directives(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Directives(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]introspection.Directive) + fc.Result = res + return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Schema_directives(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Schema", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Directive_name(ctx, field) + case "description": + return ec.fieldContext___Directive_description(ctx, field) + case "locations": + return ec.fieldContext___Directive_locations(ctx, field) + case "args": + return ec.fieldContext___Directive_args(ctx, field) + case "isRepeatable": + return ec.fieldContext___Directive_isRepeatable(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_kind(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Kind(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalN__TypeKind2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_kind(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type __TypeKind does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_description(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Description(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_description(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_fields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Field) + fc.Result = res + return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___Field_name(ctx, field) + case "description": + return ec.fieldContext___Field_description(ctx, field) + case "args": + return ec.fieldContext___Field_args(ctx, field) + case "type": + return ec.fieldContext___Field_type(ctx, field) + case "isDeprecated": + return ec.fieldContext___Field_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___Field_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_interfaces(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Interfaces(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_interfaces(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.PossibleTypes(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_possibleTypes(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_enumValues(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.EnumValue) + fc.Result = res + return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___EnumValue_name(ctx, field) + case "description": + return ec.fieldContext___EnumValue_description(ctx, field) + case "isDeprecated": + return ec.fieldContext___EnumValue_isDeprecated(ctx, field) + case "deprecationReason": + return ec.fieldContext___EnumValue_deprecationReason(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_inputFields(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.InputFields(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]introspection.InputValue) + fc.Result = res + return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_inputFields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "name": + return ec.fieldContext___InputValue_name(ctx, field) + case "description": + return ec.fieldContext___InputValue_description(ctx, field) + case "type": + return ec.fieldContext___InputValue_type(ctx, field) + case "defaultValue": + return ec.fieldContext___InputValue_defaultValue(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_ofType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.OfType(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*introspection.Type) + fc.Result = res + return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_ofType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "kind": + return ec.fieldContext___Type_kind(ctx, field) + case "name": + return ec.fieldContext___Type_name(ctx, field) + case "description": + return ec.fieldContext___Type_description(ctx, field) + case "fields": + return ec.fieldContext___Type_fields(ctx, field) + case "interfaces": + return ec.fieldContext___Type_interfaces(ctx, field) + case "possibleTypes": + return ec.fieldContext___Type_possibleTypes(ctx, field) + case "enumValues": + return ec.fieldContext___Type_enumValues(ctx, field) + case "inputFields": + return ec.fieldContext___Type_inputFields(ctx, field) + case "ofType": + return ec.fieldContext___Type_ofType(ctx, field) + case "specifiedByURL": + return ec.fieldContext___Type_specifiedByURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { + fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SpecifiedByURL(), nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "__Type", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +// endregion **************************** field.gotpl ***************************** + +// region **************************** input.gotpl ***************************** + +func (ec *executionContext) unmarshalInputCreateTeamRequestInput(ctx context.Context, obj interface{}) (dto.CreateTeamRequestInput, error) { + var it dto.CreateTeamRequestInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"teamID", "request", "title"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "teamID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("teamID")) + data, err := ec.unmarshalNID2string(ctx, v) + if err != nil { + return it, err + } + it.TeamID = data + case "request": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Request = data + case "title": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Title = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputEnableAndDisableSSOArgs(ctx context.Context, obj interface{}) (dto.EnableAndDisableSSOArgs, error) { + var it dto.EnableAndDisableSSOArgs + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"provider", "status"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "provider": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("provider")) + data, err := ec.unmarshalNAuthProvider2dtoᚐAuthProvider(ctx, v) + if err != nil { + return it, err + } + it.Provider = data + case "status": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) + data, err := ec.unmarshalNServiceStatus2dtoᚐServiceStatus(ctx, v) + if err != nil { + return it, err + } + it.Status = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputInfraConfigArgs(ctx context.Context, obj interface{}) (dto.InfraConfigArgs, error) { + var it dto.InfraConfigArgs + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"name", "value"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNInfraConfigEnum2dtoᚐInfraConfigEnum(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "value": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Value = data + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputUpdateTeamRequestInput(ctx context.Context, obj interface{}) (dto.UpdateTeamRequestInput, error) { + var it dto.UpdateTeamRequestInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"request", "title"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "request": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("request")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Request = data + case "title": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("title")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Title = data + } + } + + return it, nil +} + +// endregion **************************** input.gotpl ***************************** + +// region ************************** interface.gotpl *************************** + +// endregion ************************** interface.gotpl *************************** + +// region **************************** object.gotpl **************************** + +var adminImplementors = []string{"Admin"} + +func (ec *executionContext) _Admin(ctx context.Context, sel ast.SelectionSet, obj *dto.Admin) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, adminImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Admin") + case "uid": + out.Values[i] = ec._Admin_uid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "displayName": + out.Values[i] = ec._Admin_displayName(ctx, field, obj) + case "email": + out.Values[i] = ec._Admin_email(ctx, field, obj) + case "photoURL": + out.Values[i] = ec._Admin_photoURL(ctx, field, obj) + case "createdOn": + out.Values[i] = ec._Admin_createdOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "admins": + out.Values[i] = ec._Admin_admins(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "userInfo": + out.Values[i] = ec._Admin_userInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "allUsers": + out.Values[i] = ec._Admin_allUsers(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "invitedUsers": + out.Values[i] = ec._Admin_invitedUsers(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "allTeams": + out.Values[i] = ec._Admin_allTeams(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamInfo": + out.Values[i] = ec._Admin_teamInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "membersCountInTeam": + out.Values[i] = ec._Admin_membersCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectionCountInTeam": + out.Values[i] = ec._Admin_collectionCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "requestCountInTeam": + out.Values[i] = ec._Admin_requestCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentCountInTeam": + out.Values[i] = ec._Admin_environmentCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pendingInvitationCountInTeam": + out.Values[i] = ec._Admin_pendingInvitationCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "usersCount": + out.Values[i] = ec._Admin_usersCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamsCount": + out.Values[i] = ec._Admin_teamsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamCollectionsCount": + out.Values[i] = ec._Admin_teamCollectionsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamRequestsCount": + out.Values[i] = ec._Admin_teamRequestsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var collectionReorderDataImplementors = []string{"CollectionReorderData"} + +func (ec *executionContext) _CollectionReorderData(ctx context.Context, sel ast.SelectionSet, obj *dto.CollectionReorderData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, collectionReorderDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("CollectionReorderData") + case "collection": + out.Values[i] = ec._CollectionReorderData_collection(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nextCollection": + out.Values[i] = ec._CollectionReorderData_nextCollection(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var infraImplementors = []string{"Infra"} + +func (ec *executionContext) _Infra(ctx context.Context, sel ast.SelectionSet, obj *dto.Infra) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, infraImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Infra") + case "executedBy": + out.Values[i] = ec._Infra_executedBy(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "admins": + out.Values[i] = ec._Infra_admins(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "userInfo": + out.Values[i] = ec._Infra_userInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "allUsers": + out.Values[i] = ec._Infra_allUsers(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "invitedUsers": + out.Values[i] = ec._Infra_invitedUsers(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "allTeams": + out.Values[i] = ec._Infra_allTeams(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamInfo": + out.Values[i] = ec._Infra_teamInfo(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "membersCountInTeam": + out.Values[i] = ec._Infra_membersCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectionCountInTeam": + out.Values[i] = ec._Infra_collectionCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "requestCountInTeam": + out.Values[i] = ec._Infra_requestCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "environmentCountInTeam": + out.Values[i] = ec._Infra_environmentCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pendingInvitationCountInTeam": + out.Values[i] = ec._Infra_pendingInvitationCountInTeam(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "usersCount": + out.Values[i] = ec._Infra_usersCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamsCount": + out.Values[i] = ec._Infra_teamsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamCollectionsCount": + out.Values[i] = ec._Infra_teamCollectionsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamRequestsCount": + out.Values[i] = ec._Infra_teamRequestsCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "allShortcodes": + out.Values[i] = ec._Infra_allShortcodes(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var infraConfigImplementors = []string{"InfraConfig"} + +func (ec *executionContext) _InfraConfig(ctx context.Context, sel ast.SelectionSet, obj *model.InfraConfig) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, infraConfigImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("InfraConfig") + case "name": + out.Values[i] = ec._InfraConfig_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "value": + out.Values[i] = ec._InfraConfig_value(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var invitedUserImplementors = []string{"InvitedUser"} + +func (ec *executionContext) _InvitedUser(ctx context.Context, sel ast.SelectionSet, obj *model.InvitedUser) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, invitedUserImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("InvitedUser") + case "adminUid": + out.Values[i] = ec._InvitedUser_adminUid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "adminEmail": + out.Values[i] = ec._InvitedUser_adminEmail(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "inviteeEmail": + out.Values[i] = ec._InvitedUser_inviteeEmail(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "invitedOn": + out.Values[i] = ec._InvitedUser_invitedOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "updateUserSessions": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUserSessions(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateInfraConfigs": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateInfraConfigs(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "resetInfraConfigs": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_resetInfraConfigs(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "enableAndDisableSSO": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_enableAndDisableSSO(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "inviteNewUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_inviteNewUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeUserByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeUserByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "makeUserAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_makeUserAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeUserAsAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeUserAsAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "changeUserRoleInTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_changeUserRoleInTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeUserFromTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeUserFromTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "addUserToTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_addUserToTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "renameTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_renameTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteTeamByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteTeamByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "revokeTeamInviteByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_revokeTeamInviteByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "revokeShortcodeByAdmin": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_revokeShortcodeByAdmin(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createTeam": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createTeam(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "leaveTeam": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_leaveTeam(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeTeamMember": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeTeamMember(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "renameTeam": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_renameTeam(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteTeam": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteTeam(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateTeamMemberRole": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateTeamMemberRole(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createTeamInvitation": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createTeamInvitation(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "revokeTeamInvitation": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_revokeTeamInvitation(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "acceptTeamInvitation": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_acceptTeamInvitation(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createTeamEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createTeamEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteTeamEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteTeamEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateTeamEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateTeamEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteAllVariablesFromTeamEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteAllVariablesFromTeamEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createDuplicateEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDuplicateEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createRootCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRootCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "importCollectionsFromJSON": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_importCollectionsFromJSON(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "replaceCollectionsWithJSON": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_replaceCollectionsWithJSON(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createChildCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createChildCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "renameCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_renameCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "moveCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_moveCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateCollectionOrder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateCollectionOrder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateTeamCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateTeamCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createRequestInCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRequestInCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateLookUpRequestOrder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateLookUpRequestOrder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "moveRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_moveRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createShortcode": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createShortcode(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateEmbedProperties": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateEmbedProperties(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "revokeShortcode": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_revokeShortcode(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createUserSettings": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createUserSettings(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateUserSettings": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUserSettings(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createUserEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createUserEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createUserGlobalEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createUserGlobalEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateUserEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUserEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUserEnvironment": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUserEnvironment(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUserEnvironments": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUserEnvironments(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "clearGlobalEnvironments": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_clearGlobalEnvironments(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createUserHistory": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createUserHistory(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "toggleHistoryStarStatus": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_toggleHistoryStarStatus(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeRequestFromHistory": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeRequestFromHistory(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteAllUserHistory": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteAllUserHistory(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createRESTUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRESTUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createGQLUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createGQLUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateRESTUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateRESTUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateGQLUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateGQLUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "moveUserRequest": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_moveUserRequest(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createRESTRootUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRESTRootUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createGQLRootUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createGQLRootUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createGQLChildUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createGQLChildUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createRESTChildUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createRESTChildUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "renameUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_renameUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "moveUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_moveUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateUserCollectionOrder": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUserCollectionOrder(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "importUserCollectionsFromJSON": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_importUserCollectionsFromJSON(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateUserCollection": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateUserCollection(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var queryImplementors = []string{"Query"} + +func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Query", + }) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ + Object: field.Name, + Field: field, + }) + + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Query") + case "me": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_me(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "infra": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_infra(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "infraConfigs": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_infraConfigs(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "allowedAuthProviders": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_allowedAuthProviders(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "admin": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_admin(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "myTeams": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_myTeams(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "team": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_team(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "teamInvitation": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_teamInvitation(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "exportCollectionsToJSON": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_exportCollectionsToJSON(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "rootCollectionsOfTeam": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_rootCollectionsOfTeam(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "collection": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_collection(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "searchForRequest": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_searchForRequest(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "request": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_request(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "requestsInCollection": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_requestsInCollection(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "shortcode": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_shortcode(ctx, field) + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "myShortcodes": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_myShortcodes(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "userRESTRequests": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_userRESTRequests(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "userGQLRequests": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_userGQLRequests(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "userRequest": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_userRequest(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "rootRESTUserCollections": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_rootRESTUserCollections(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "rootGQLUserCollections": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_rootGQLUserCollections(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "userCollection": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_userCollection(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "exportUserCollectionsToJSON": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_exportUserCollectionsToJSON(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "__type": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___schema(ctx, field) + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var requestReorderDataImplementors = []string{"RequestReorderData"} + +func (ec *executionContext) _RequestReorderData(ctx context.Context, sel ast.SelectionSet, obj *dto.RequestReorderData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, requestReorderDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("RequestReorderData") + case "request": + out.Values[i] = ec._RequestReorderData_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nextRequest": + out.Values[i] = ec._RequestReorderData_nextRequest(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var shortcodeImplementors = []string{"Shortcode"} + +func (ec *executionContext) _Shortcode(ctx context.Context, sel ast.SelectionSet, obj *model.Shortcode) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, shortcodeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Shortcode") + case "id": + out.Values[i] = ec._Shortcode_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "request": + out.Values[i] = ec._Shortcode_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "properties": + out.Values[i] = ec._Shortcode_properties(ctx, field, obj) + case "createdOn": + out.Values[i] = ec._Shortcode_createdOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var shortcodeCreatorImplementors = []string{"ShortcodeCreator"} + +func (ec *executionContext) _ShortcodeCreator(ctx context.Context, sel ast.SelectionSet, obj *dto.ShortcodeCreator) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, shortcodeCreatorImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ShortcodeCreator") + case "uid": + out.Values[i] = ec._ShortcodeCreator_uid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "email": + out.Values[i] = ec._ShortcodeCreator_email(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var shortcodeWithUserEmailImplementors = []string{"ShortcodeWithUserEmail"} + +func (ec *executionContext) _ShortcodeWithUserEmail(ctx context.Context, sel ast.SelectionSet, obj *dto.ShortcodeWithUserEmail) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, shortcodeWithUserEmailImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("ShortcodeWithUserEmail") + case "id": + out.Values[i] = ec._ShortcodeWithUserEmail_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "request": + out.Values[i] = ec._ShortcodeWithUserEmail_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "properties": + out.Values[i] = ec._ShortcodeWithUserEmail_properties(ctx, field, obj) + case "createdOn": + out.Values[i] = ec._ShortcodeWithUserEmail_createdOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "creator": + out.Values[i] = ec._ShortcodeWithUserEmail_creator(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var subscriptionImplementors = []string{"Subscription"} + +func (ec *executionContext) _Subscription(ctx context.Context, sel ast.SelectionSet) func(ctx context.Context) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionImplementors) + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Subscription", + }) + if len(fields) != 1 { + ec.Errorf(ctx, "must subscribe to exactly one stream") + return nil + } + + switch fields[0].Name { + case "userUpdated": + return ec._Subscription_userUpdated(ctx, fields[0]) + case "userDeleted": + return ec._Subscription_userDeleted(ctx, fields[0]) + case "userInvited": + return ec._Subscription_userInvited(ctx, fields[0]) + case "teamMemberAdded": + return ec._Subscription_teamMemberAdded(ctx, fields[0]) + case "teamMemberUpdated": + return ec._Subscription_teamMemberUpdated(ctx, fields[0]) + case "teamMemberRemoved": + return ec._Subscription_teamMemberRemoved(ctx, fields[0]) + case "teamInvitationAdded": + return ec._Subscription_teamInvitationAdded(ctx, fields[0]) + case "teamInvitationRemoved": + return ec._Subscription_teamInvitationRemoved(ctx, fields[0]) + case "teamEnvironmentUpdated": + return ec._Subscription_teamEnvironmentUpdated(ctx, fields[0]) + case "teamEnvironmentCreated": + return ec._Subscription_teamEnvironmentCreated(ctx, fields[0]) + case "teamEnvironmentDeleted": + return ec._Subscription_teamEnvironmentDeleted(ctx, fields[0]) + case "teamCollectionAdded": + return ec._Subscription_teamCollectionAdded(ctx, fields[0]) + case "teamCollectionUpdated": + return ec._Subscription_teamCollectionUpdated(ctx, fields[0]) + case "teamCollectionRemoved": + return ec._Subscription_teamCollectionRemoved(ctx, fields[0]) + case "teamCollectionMoved": + return ec._Subscription_teamCollectionMoved(ctx, fields[0]) + case "collectionOrderUpdated": + return ec._Subscription_collectionOrderUpdated(ctx, fields[0]) + case "teamRequestAdded": + return ec._Subscription_teamRequestAdded(ctx, fields[0]) + case "teamRequestUpdated": + return ec._Subscription_teamRequestUpdated(ctx, fields[0]) + case "teamRequestDeleted": + return ec._Subscription_teamRequestDeleted(ctx, fields[0]) + case "requestOrderUpdated": + return ec._Subscription_requestOrderUpdated(ctx, fields[0]) + case "requestMoved": + return ec._Subscription_requestMoved(ctx, fields[0]) + case "myShortcodesCreated": + return ec._Subscription_myShortcodesCreated(ctx, fields[0]) + case "myShortcodesUpdated": + return ec._Subscription_myShortcodesUpdated(ctx, fields[0]) + case "myShortcodesRevoked": + return ec._Subscription_myShortcodesRevoked(ctx, fields[0]) + case "userSettingsCreated": + return ec._Subscription_userSettingsCreated(ctx, fields[0]) + case "userSettingsUpdated": + return ec._Subscription_userSettingsUpdated(ctx, fields[0]) + case "userEnvironmentCreated": + return ec._Subscription_userEnvironmentCreated(ctx, fields[0]) + case "userEnvironmentUpdated": + return ec._Subscription_userEnvironmentUpdated(ctx, fields[0]) + case "userEnvironmentDeleted": + return ec._Subscription_userEnvironmentDeleted(ctx, fields[0]) + case "userEnvironmentDeleteMany": + return ec._Subscription_userEnvironmentDeleteMany(ctx, fields[0]) + case "userHistoryCreated": + return ec._Subscription_userHistoryCreated(ctx, fields[0]) + case "userHistoryUpdated": + return ec._Subscription_userHistoryUpdated(ctx, fields[0]) + case "userHistoryDeleted": + return ec._Subscription_userHistoryDeleted(ctx, fields[0]) + case "userHistoryDeletedMany": + return ec._Subscription_userHistoryDeletedMany(ctx, fields[0]) + case "userRequestCreated": + return ec._Subscription_userRequestCreated(ctx, fields[0]) + case "userRequestUpdated": + return ec._Subscription_userRequestUpdated(ctx, fields[0]) + case "userRequestDeleted": + return ec._Subscription_userRequestDeleted(ctx, fields[0]) + case "userRequestMoved": + return ec._Subscription_userRequestMoved(ctx, fields[0]) + case "userCollectionCreated": + return ec._Subscription_userCollectionCreated(ctx, fields[0]) + case "userCollectionUpdated": + return ec._Subscription_userCollectionUpdated(ctx, fields[0]) + case "userCollectionRemoved": + return ec._Subscription_userCollectionRemoved(ctx, fields[0]) + case "userCollectionMoved": + return ec._Subscription_userCollectionMoved(ctx, fields[0]) + case "userCollectionOrderUpdated": + return ec._Subscription_userCollectionOrderUpdated(ctx, fields[0]) + default: + panic("unknown field " + strconv.Quote(fields[0].Name)) + } +} + +var teamImplementors = []string{"Team"} + +func (ec *executionContext) _Team(ctx context.Context, sel ast.SelectionSet, obj *model.Team) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Team") + case "id": + out.Values[i] = ec._Team_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Team_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "members": + out.Values[i] = ec._Team_members(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "teamMembers": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_teamMembers(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "myRole": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_myRole(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "ownersCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_ownersCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "editorsCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_editorsCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "viewersCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_viewersCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "teamInvitations": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_teamInvitations(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "teamEnvironments": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Team_teamEnvironments(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var teamCollectionImplementors = []string{"TeamCollection"} + +func (ec *executionContext) _TeamCollection(ctx context.Context, sel ast.SelectionSet, obj *model.TeamCollection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamCollectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TeamCollection") + case "id": + out.Values[i] = ec._TeamCollection_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._TeamCollection_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "data": + out.Values[i] = ec._TeamCollection_data(ctx, field, obj) + case "parentID": + out.Values[i] = ec._TeamCollection_parentID(ctx, field, obj) + case "team": + out.Values[i] = ec._TeamCollection_team(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "parent": + out.Values[i] = ec._TeamCollection_parent(ctx, field, obj) + case "children": + out.Values[i] = ec._TeamCollection_children(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var teamEnvironmentImplementors = []string{"TeamEnvironment"} + +func (ec *executionContext) _TeamEnvironment(ctx context.Context, sel ast.SelectionSet, obj *model.TeamEnvironment) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamEnvironmentImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TeamEnvironment") + case "id": + out.Values[i] = ec._TeamEnvironment_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamID": + out.Values[i] = ec._TeamEnvironment_teamID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._TeamEnvironment_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "variables": + out.Values[i] = ec._TeamEnvironment_variables(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var teamInvitationImplementors = []string{"TeamInvitation"} + +func (ec *executionContext) _TeamInvitation(ctx context.Context, sel ast.SelectionSet, obj *model.TeamInvitation) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamInvitationImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TeamInvitation") + case "id": + out.Values[i] = ec._TeamInvitation_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamID": + out.Values[i] = ec._TeamInvitation_teamID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "creatorUid": + out.Values[i] = ec._TeamInvitation_creatorUid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "inviteeEmail": + out.Values[i] = ec._TeamInvitation_inviteeEmail(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "inviteeRole": + out.Values[i] = ec._TeamInvitation_inviteeRole(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "team": + out.Values[i] = ec._TeamInvitation_team(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "creator": + out.Values[i] = ec._TeamInvitation_creator(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var teamMemberImplementors = []string{"TeamMember"} + +func (ec *executionContext) _TeamMember(ctx context.Context, sel ast.SelectionSet, obj *model.TeamMember) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamMemberImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TeamMember") + case "membershipID": + out.Values[i] = ec._TeamMember_membershipID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "role": + out.Values[i] = ec._TeamMember_role(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "user": + out.Values[i] = ec._TeamMember_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var teamRequestImplementors = []string{"TeamRequest"} + +func (ec *executionContext) _TeamRequest(ctx context.Context, sel ast.SelectionSet, obj *model.TeamRequest) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, teamRequestImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("TeamRequest") + case "id": + out.Values[i] = ec._TeamRequest_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectionID": + out.Values[i] = ec._TeamRequest_collectionID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "teamID": + out.Values[i] = ec._TeamRequest_teamID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "request": + out.Values[i] = ec._TeamRequest_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._TeamRequest_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "team": + out.Values[i] = ec._TeamRequest_team(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collection": + out.Values[i] = ec._TeamRequest_collection(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userImplementors = []string{"User"} + +func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *model.User) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("User") + case "uid": + out.Values[i] = ec._User_uid(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "displayName": + out.Values[i] = ec._User_displayName(ctx, field, obj) + case "email": + out.Values[i] = ec._User_email(ctx, field, obj) + case "photoURL": + out.Values[i] = ec._User_photoURL(ctx, field, obj) + case "isAdmin": + out.Values[i] = ec._User_isAdmin(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "createdOn": + out.Values[i] = ec._User_createdOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "currentRESTSession": + out.Values[i] = ec._User_currentRESTSession(ctx, field, obj) + case "currentGQLSession": + out.Values[i] = ec._User_currentGQLSession(ctx, field, obj) + case "settings": + out.Values[i] = ec._User_settings(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "environments": + out.Values[i] = ec._User_environments(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "globalEnvironments": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_globalEnvironments(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "RESTHistory": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_RESTHistory(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "GQLHistory": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_GQLHistory(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userCollectionImplementors = []string{"UserCollection"} + +func (ec *executionContext) _UserCollection(ctx context.Context, sel ast.SelectionSet, obj *model.UserCollection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userCollectionImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserCollection") + case "id": + out.Values[i] = ec._UserCollection_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "title": + out.Values[i] = ec._UserCollection_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "data": + out.Values[i] = ec._UserCollection_data(ctx, field, obj) + case "type": + out.Values[i] = ec._UserCollection_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "requests": + out.Values[i] = ec._UserCollection_requests(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "user": + out.Values[i] = ec._UserCollection_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "parent": + out.Values[i] = ec._UserCollection_parent(ctx, field, obj) + case "childrenREST": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._UserCollection_childrenREST(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "childrenGQL": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._UserCollection_childrenGQL(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userCollectionExportJSONDataImplementors = []string{"UserCollectionExportJSONData"} + +func (ec *executionContext) _UserCollectionExportJSONData(ctx context.Context, sel ast.SelectionSet, obj *dto.UserCollectionExportJSONData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userCollectionExportJSONDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserCollectionExportJSONData") + case "exportedCollection": + out.Values[i] = ec._UserCollectionExportJSONData_exportedCollection(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectionType": + out.Values[i] = ec._UserCollectionExportJSONData_collectionType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userCollectionRemovedDataImplementors = []string{"UserCollectionRemovedData"} + +func (ec *executionContext) _UserCollectionRemovedData(ctx context.Context, sel ast.SelectionSet, obj *dto.UserCollectionRemovedData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userCollectionRemovedDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserCollectionRemovedData") + case "id": + out.Values[i] = ec._UserCollectionRemovedData_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec._UserCollectionRemovedData_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userCollectionReorderDataImplementors = []string{"UserCollectionReorderData"} + +func (ec *executionContext) _UserCollectionReorderData(ctx context.Context, sel ast.SelectionSet, obj *dto.UserCollectionReorderData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userCollectionReorderDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserCollectionReorderData") + case "userCollection": + out.Values[i] = ec._UserCollectionReorderData_userCollection(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nextUserCollection": + out.Values[i] = ec._UserCollectionReorderData_nextUserCollection(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userEnvironmentImplementors = []string{"UserEnvironment"} + +func (ec *executionContext) _UserEnvironment(ctx context.Context, sel ast.SelectionSet, obj *model.UserEnvironment) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userEnvironmentImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserEnvironment") + case "id": + out.Values[i] = ec._UserEnvironment_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "userUid": + out.Values[i] = ec._UserEnvironment_userUid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec._UserEnvironment_name(ctx, field, obj) + case "variables": + out.Values[i] = ec._UserEnvironment_variables(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isGlobal": + out.Values[i] = ec._UserEnvironment_isGlobal(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userHistoryImplementors = []string{"UserHistory"} + +func (ec *executionContext) _UserHistory(ctx context.Context, sel ast.SelectionSet, obj *model.UserHistory) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userHistoryImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserHistory") + case "id": + out.Values[i] = ec._UserHistory_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "userUid": + out.Values[i] = ec._UserHistory_userUid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "reqType": + out.Values[i] = ec._UserHistory_reqType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "request": + out.Values[i] = ec._UserHistory_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "responseMetadata": + out.Values[i] = ec._UserHistory_responseMetadata(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isStarred": + out.Values[i] = ec._UserHistory_isStarred(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "executedOn": + out.Values[i] = ec._UserHistory_executedOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userHistoryDeletedManyDataImplementors = []string{"UserHistoryDeletedManyData"} + +func (ec *executionContext) _UserHistoryDeletedManyData(ctx context.Context, sel ast.SelectionSet, obj *dto.UserHistoryDeletedManyData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userHistoryDeletedManyDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserHistoryDeletedManyData") + case "count": + out.Values[i] = ec._UserHistoryDeletedManyData_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "reqType": + out.Values[i] = ec._UserHistoryDeletedManyData_reqType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userRequestImplementors = []string{"UserRequest"} + +func (ec *executionContext) _UserRequest(ctx context.Context, sel ast.SelectionSet, obj *model.UserRequest) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userRequestImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserRequest") + case "id": + out.Values[i] = ec._UserRequest_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "collectionID": + out.Values[i] = ec._UserRequest_collectionID(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "title": + out.Values[i] = ec._UserRequest_title(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "request": + out.Values[i] = ec._UserRequest_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec._UserRequest_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdOn": + out.Values[i] = ec._UserRequest_createdOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "user": + out.Values[i] = ec._UserRequest_user(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userRequestReorderDataImplementors = []string{"UserRequestReorderData"} + +func (ec *executionContext) _UserRequestReorderData(ctx context.Context, sel ast.SelectionSet, obj *dto.UserRequestReorderData) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userRequestReorderDataImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserRequestReorderData") + case "request": + out.Values[i] = ec._UserRequestReorderData_request(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "nextRequest": + out.Values[i] = ec._UserRequestReorderData_nextRequest(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var userSettingsImplementors = []string{"UserSettings"} + +func (ec *executionContext) _UserSettings(ctx context.Context, sel ast.SelectionSet, obj *model.UserSetting) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, userSettingsImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UserSettings") + case "id": + out.Values[i] = ec._UserSettings_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "userUid": + out.Values[i] = ec._UserSettings_userUid(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "properties": + out.Values[i] = ec._UserSettings_properties(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updatedOn": + out.Values[i] = ec._UserSettings_updatedOn(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __DirectiveImplementors = []string{"__Directive"} + +func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Directive") + case "name": + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __EnumValueImplementors = []string{"__EnumValue"} + +func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__EnumValue") + case "name": + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __FieldImplementors = []string{"__Field"} + +func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Field") + case "name": + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __InputValueImplementors = []string{"__InputValue"} + +func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__InputValue") + case "name": + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __SchemaImplementors = []string{"__Schema"} + +func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Schema") + case "description": + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + out.Values[i] = ec.___Schema_directives(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var __TypeImplementors = []string{"__Type"} + +func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("__Type") + case "kind": + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "specifiedByURL": + out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +// endregion **************************** object.gotpl **************************** + +// region ***************************** type.gotpl ***************************** + +func (ec *executionContext) marshalNAdmin2dtoᚐAdmin(ctx context.Context, sel ast.SelectionSet, v dto.Admin) graphql.Marshaler { + return ec._Admin(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAdmin2ᚖdtoᚐAdmin(ctx context.Context, sel ast.SelectionSet, v *dto.Admin) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Admin(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNAuthProvider2dtoᚐAuthProvider(ctx context.Context, v interface{}) (dto.AuthProvider, error) { + var res dto.AuthProvider + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNAuthProvider2dtoᚐAuthProvider(ctx context.Context, sel ast.SelectionSet, v dto.AuthProvider) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNCollectionReorderData2dtoᚐCollectionReorderData(ctx context.Context, sel ast.SelectionSet, v dto.CollectionReorderData) graphql.Marshaler { + return ec._CollectionReorderData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCollectionReorderData2ᚖdtoᚐCollectionReorderData(ctx context.Context, sel ast.SelectionSet, v *dto.CollectionReorderData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._CollectionReorderData(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNCreateTeamRequestInput2dtoᚐCreateTeamRequestInput(ctx context.Context, v interface{}) (dto.CreateTeamRequestInput, error) { + res, err := ec.unmarshalInputCreateTeamRequestInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNDateTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { + res, err := UnmarshalDateTimeScalar(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDateTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { + res := MarshalDateTimeScalar(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNEnableAndDisableSSOArgs2ᚕᚖdtoᚐEnableAndDisableSSOArgsᚄ(ctx context.Context, v interface{}) ([]*dto.EnableAndDisableSSOArgs, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*dto.EnableAndDisableSSOArgs, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNEnableAndDisableSSOArgs2ᚖdtoᚐEnableAndDisableSSOArgs(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNEnableAndDisableSSOArgs2ᚖdtoᚐEnableAndDisableSSOArgs(ctx context.Context, v interface{}) (*dto.EnableAndDisableSSOArgs, error) { + res, err := ec.unmarshalInputEnableAndDisableSSOArgs(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalID(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalID(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNInfra2dtoᚐInfra(ctx context.Context, sel ast.SelectionSet, v dto.Infra) graphql.Marshaler { + return ec._Infra(ctx, sel, &v) +} + +func (ec *executionContext) marshalNInfra2ᚖdtoᚐInfra(ctx context.Context, sel ast.SelectionSet, v *dto.Infra) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Infra(ctx, sel, v) +} + +func (ec *executionContext) marshalNInfraConfig2ᚕᚖmodelᚐInfraConfigᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.InfraConfig) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNInfraConfig2ᚖmodelᚐInfraConfig(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNInfraConfig2ᚖmodelᚐInfraConfig(ctx context.Context, sel ast.SelectionSet, v *model.InfraConfig) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._InfraConfig(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNInfraConfigArgs2ᚕᚖdtoᚐInfraConfigArgsᚄ(ctx context.Context, v interface{}) ([]*dto.InfraConfigArgs, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]*dto.InfraConfigArgs, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNInfraConfigArgs2ᚖdtoᚐInfraConfigArgs(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) unmarshalNInfraConfigArgs2ᚖdtoᚐInfraConfigArgs(ctx context.Context, v interface{}) (*dto.InfraConfigArgs, error) { + res, err := ec.unmarshalInputInfraConfigArgs(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNInfraConfigEnum2dtoᚐInfraConfigEnum(ctx context.Context, v interface{}) (dto.InfraConfigEnum, error) { + var res dto.InfraConfigEnum + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInfraConfigEnum2dtoᚐInfraConfigEnum(ctx context.Context, sel ast.SelectionSet, v dto.InfraConfigEnum) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNInfraConfigEnum2ᚕdtoᚐInfraConfigEnumᚄ(ctx context.Context, v interface{}) ([]dto.InfraConfigEnum, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]dto.InfraConfigEnum, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNInfraConfigEnum2dtoᚐInfraConfigEnum(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNInfraConfigEnum2ᚕdtoᚐInfraConfigEnumᚄ(ctx context.Context, sel ast.SelectionSet, v []dto.InfraConfigEnum) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNInfraConfigEnum2dtoᚐInfraConfigEnum(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { + res, err := graphql.UnmarshalInt(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { + res := graphql.MarshalInt(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNInvitedUser2modelᚐInvitedUser(ctx context.Context, sel ast.SelectionSet, v model.InvitedUser) graphql.Marshaler { + return ec._InvitedUser(ctx, sel, &v) +} + +func (ec *executionContext) marshalNInvitedUser2ᚕᚖmodelᚐInvitedUserᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.InvitedUser) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNInvitedUser2ᚖmodelᚐInvitedUser(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNInvitedUser2ᚖmodelᚐInvitedUser(ctx context.Context, sel ast.SelectionSet, v *model.InvitedUser) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._InvitedUser(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNReqType2modelᚐReqType(ctx context.Context, v interface{}) (model.ReqType, error) { + tmp, err := graphql.UnmarshalString(v) + res := model.ReqType(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNReqType2modelᚐReqType(ctx context.Context, sel ast.SelectionSet, v model.ReqType) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNRequestReorderData2dtoᚐRequestReorderData(ctx context.Context, sel ast.SelectionSet, v dto.RequestReorderData) graphql.Marshaler { + return ec._RequestReorderData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRequestReorderData2ᚖdtoᚐRequestReorderData(ctx context.Context, sel ast.SelectionSet, v *dto.RequestReorderData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._RequestReorderData(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNServiceStatus2dtoᚐServiceStatus(ctx context.Context, v interface{}) (dto.ServiceStatus, error) { + var res dto.ServiceStatus + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNServiceStatus2dtoᚐServiceStatus(ctx context.Context, sel ast.SelectionSet, v dto.ServiceStatus) graphql.Marshaler { + return v +} + +func (ec *executionContext) unmarshalNSessionType2modelᚐReqType(ctx context.Context, v interface{}) (model.ReqType, error) { + tmp, err := graphql.UnmarshalString(v) + res := model.ReqType(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNSessionType2modelᚐReqType(ctx context.Context, sel ast.SelectionSet, v model.ReqType) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNShortcode2modelᚐShortcode(ctx context.Context, sel ast.SelectionSet, v model.Shortcode) graphql.Marshaler { + return ec._Shortcode(ctx, sel, &v) +} + +func (ec *executionContext) marshalNShortcode2ᚕᚖmodelᚐShortcodeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Shortcode) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNShortcode2ᚖmodelᚐShortcode(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNShortcode2ᚖmodelᚐShortcode(ctx context.Context, sel ast.SelectionSet, v *model.Shortcode) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Shortcode(ctx, sel, v) +} + +func (ec *executionContext) marshalNShortcodeWithUserEmail2ᚕᚖdtoᚐShortcodeWithUserEmailᚄ(ctx context.Context, sel ast.SelectionSet, v []*dto.ShortcodeWithUserEmail) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNShortcodeWithUserEmail2ᚖdtoᚐShortcodeWithUserEmail(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNShortcodeWithUserEmail2ᚖdtoᚐShortcodeWithUserEmail(ctx context.Context, sel ast.SelectionSet, v *dto.ShortcodeWithUserEmail) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._ShortcodeWithUserEmail(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNString2string(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + res := graphql.MarshalString(*v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNTeam2modelᚐTeam(ctx context.Context, sel ast.SelectionSet, v model.Team) graphql.Marshaler { + return ec._Team(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeam2ᚕᚖmodelᚐTeamᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.Team) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeam2ᚖmodelᚐTeam(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeam2ᚖmodelᚐTeam(ctx context.Context, sel ast.SelectionSet, v *model.Team) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Team(ctx, sel, v) +} + +func (ec *executionContext) marshalNTeamCollection2modelᚐTeamCollection(ctx context.Context, sel ast.SelectionSet, v model.TeamCollection) graphql.Marshaler { + return ec._TeamCollection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamCollection2ᚕmodelᚐTeamCollectionᚄ(ctx context.Context, sel ast.SelectionSet, v []model.TeamCollection) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamCollection2modelᚐTeamCollection(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamCollection2ᚕᚖmodelᚐTeamCollectionᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TeamCollection) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamCollection2ᚖmodelᚐTeamCollection(ctx context.Context, sel ast.SelectionSet, v *model.TeamCollection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TeamCollection(ctx, sel, v) +} + +func (ec *executionContext) marshalNTeamEnvironment2modelᚐTeamEnvironment(ctx context.Context, sel ast.SelectionSet, v model.TeamEnvironment) graphql.Marshaler { + return ec._TeamEnvironment(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamEnvironment2ᚕᚖmodelᚐTeamEnvironmentᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TeamEnvironment) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamEnvironment2ᚖmodelᚐTeamEnvironment(ctx context.Context, sel ast.SelectionSet, v *model.TeamEnvironment) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TeamEnvironment(ctx, sel, v) +} + +func (ec *executionContext) marshalNTeamInvitation2modelᚐTeamInvitation(ctx context.Context, sel ast.SelectionSet, v model.TeamInvitation) graphql.Marshaler { + return ec._TeamInvitation(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamInvitation2ᚕᚖmodelᚐTeamInvitationᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TeamInvitation) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamInvitation2ᚖmodelᚐTeamInvitation(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamInvitation2ᚖmodelᚐTeamInvitation(ctx context.Context, sel ast.SelectionSet, v *model.TeamInvitation) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TeamInvitation(ctx, sel, v) +} + +func (ec *executionContext) marshalNTeamMember2modelᚐTeamMember(ctx context.Context, sel ast.SelectionSet, v model.TeamMember) graphql.Marshaler { + return ec._TeamMember(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamMember2ᚕmodelᚐTeamMemberᚄ(ctx context.Context, sel ast.SelectionSet, v []model.TeamMember) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamMember2modelᚐTeamMember(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamMember2ᚕᚖmodelᚐTeamMemberᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TeamMember) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamMember2ᚖmodelᚐTeamMember(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamMember2ᚖmodelᚐTeamMember(ctx context.Context, sel ast.SelectionSet, v *model.TeamMember) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TeamMember(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNTeamMemberRole2modelᚐTeamMemberRole(ctx context.Context, v interface{}) (model.TeamMemberRole, error) { + tmp, err := graphql.UnmarshalString(v) + res := model.TeamMemberRole(tmp) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNTeamMemberRole2modelᚐTeamMemberRole(ctx context.Context, sel ast.SelectionSet, v model.TeamMemberRole) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) marshalNTeamRequest2modelᚐTeamRequest(ctx context.Context, sel ast.SelectionSet, v model.TeamRequest) graphql.Marshaler { + return ec._TeamRequest(ctx, sel, &v) +} + +func (ec *executionContext) marshalNTeamRequest2ᚕᚖmodelᚐTeamRequestᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.TeamRequest) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNTeamRequest2ᚖmodelᚐTeamRequest(ctx context.Context, sel ast.SelectionSet, v *model.TeamRequest) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._TeamRequest(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNUpdateTeamRequestInput2dtoᚐUpdateTeamRequestInput(ctx context.Context, v interface{}) (dto.UpdateTeamRequestInput, error) { + res, err := ec.unmarshalInputUpdateTeamRequestInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNUser2modelᚐUser(ctx context.Context, sel ast.SelectionSet, v model.User) graphql.Marshaler { + return ec._User(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUser2ᚕᚖmodelᚐUserᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.User) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUser2ᚖmodelᚐUser(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUser2ᚖmodelᚐUser(ctx context.Context, sel ast.SelectionSet, v *model.User) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._User(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserCollection2modelᚐUserCollection(ctx context.Context, sel ast.SelectionSet, v model.UserCollection) graphql.Marshaler { + return ec._UserCollection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserCollection2ᚕᚖmodelᚐUserCollectionᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.UserCollection) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUserCollection2ᚖmodelᚐUserCollection(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUserCollection2ᚖmodelᚐUserCollection(ctx context.Context, sel ast.SelectionSet, v *model.UserCollection) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserCollection(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserCollectionExportJSONData2dtoᚐUserCollectionExportJSONData(ctx context.Context, sel ast.SelectionSet, v dto.UserCollectionExportJSONData) graphql.Marshaler { + return ec._UserCollectionExportJSONData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserCollectionExportJSONData2ᚖdtoᚐUserCollectionExportJSONData(ctx context.Context, sel ast.SelectionSet, v *dto.UserCollectionExportJSONData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserCollectionExportJSONData(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserCollectionRemovedData2dtoᚐUserCollectionRemovedData(ctx context.Context, sel ast.SelectionSet, v dto.UserCollectionRemovedData) graphql.Marshaler { + return ec._UserCollectionRemovedData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserCollectionRemovedData2ᚖdtoᚐUserCollectionRemovedData(ctx context.Context, sel ast.SelectionSet, v *dto.UserCollectionRemovedData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserCollectionRemovedData(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserCollectionReorderData2dtoᚐUserCollectionReorderData(ctx context.Context, sel ast.SelectionSet, v dto.UserCollectionReorderData) graphql.Marshaler { + return ec._UserCollectionReorderData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserCollectionReorderData2ᚖdtoᚐUserCollectionReorderData(ctx context.Context, sel ast.SelectionSet, v *dto.UserCollectionReorderData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserCollectionReorderData(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserEnvironment2modelᚐUserEnvironment(ctx context.Context, sel ast.SelectionSet, v model.UserEnvironment) graphql.Marshaler { + return ec._UserEnvironment(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserEnvironment2ᚕmodelᚐUserEnvironmentᚄ(ctx context.Context, sel ast.SelectionSet, v []model.UserEnvironment) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUserEnvironment2modelᚐUserEnvironment(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUserEnvironment2ᚖmodelᚐUserEnvironment(ctx context.Context, sel ast.SelectionSet, v *model.UserEnvironment) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserEnvironment(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserHistory2modelᚐUserHistory(ctx context.Context, sel ast.SelectionSet, v model.UserHistory) graphql.Marshaler { + return ec._UserHistory(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserHistory2ᚕᚖmodelᚐUserHistoryᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.UserHistory) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUserHistory2ᚖmodelᚐUserHistory(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUserHistory2ᚖmodelᚐUserHistory(ctx context.Context, sel ast.SelectionSet, v *model.UserHistory) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserHistory(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserHistoryDeletedManyData2dtoᚐUserHistoryDeletedManyData(ctx context.Context, sel ast.SelectionSet, v dto.UserHistoryDeletedManyData) graphql.Marshaler { + return ec._UserHistoryDeletedManyData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserHistoryDeletedManyData2ᚖdtoᚐUserHistoryDeletedManyData(ctx context.Context, sel ast.SelectionSet, v *dto.UserHistoryDeletedManyData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserHistoryDeletedManyData(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserRequest2modelᚐUserRequest(ctx context.Context, sel ast.SelectionSet, v model.UserRequest) graphql.Marshaler { + return ec._UserRequest(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserRequest2ᚕmodelᚐUserRequestᚄ(ctx context.Context, sel ast.SelectionSet, v []model.UserRequest) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUserRequest2modelᚐUserRequest(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUserRequest2ᚕᚖmodelᚐUserRequestᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.UserRequest) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNUserRequest2ᚖmodelᚐUserRequest(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNUserRequest2ᚖmodelᚐUserRequest(ctx context.Context, sel ast.SelectionSet, v *model.UserRequest) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserRequest(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserRequestReorderData2dtoᚐUserRequestReorderData(ctx context.Context, sel ast.SelectionSet, v dto.UserRequestReorderData) graphql.Marshaler { + return ec._UserRequestReorderData(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserRequestReorderData2ᚖdtoᚐUserRequestReorderData(ctx context.Context, sel ast.SelectionSet, v *dto.UserRequestReorderData) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserRequestReorderData(ctx, sel, v) +} + +func (ec *executionContext) marshalNUserSettings2modelᚐUserSetting(ctx context.Context, sel ast.SelectionSet, v model.UserSetting) graphql.Marshaler { + return ec._UserSettings(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUserSettings2ᚖmodelᚐUserSetting(ctx context.Context, sel ast.SelectionSet, v *model.UserSetting) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UserSettings(ctx, sel, v) +} + +func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { + return ec.___Directive(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { + var vSlice []interface{} + if v != nil { + vSlice = graphql.CoerceList(v) + } + var err error + res := make([]string, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { + return ec.___EnumValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { + return ec.___Field(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { + return ec.___InputValue(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { + return ec.___Type(ctx, sel, &v) +} + +func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { + res, err := graphql.UnmarshalString(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { + res := graphql.MarshalBoolean(v) + return res +} + +func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalBoolean(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalBoolean(*v) + return res +} + +func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalID(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalID(*v) + return res +} + +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interface{}) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalInt(*v) + return res +} + +func (ec *executionContext) marshalOShortcode2ᚖmodelᚐShortcode(ctx context.Context, sel ast.SelectionSet, v *model.Shortcode) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Shortcode(ctx, sel, v) +} + +func (ec *executionContext) marshalOShortcodeCreator2ᚖdtoᚐShortcodeCreator(ctx context.Context, sel ast.SelectionSet, v *dto.ShortcodeCreator) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._ShortcodeCreator(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalString(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(*v) + return res +} + +func (ec *executionContext) marshalOTeam2ᚖmodelᚐTeam(ctx context.Context, sel ast.SelectionSet, v *model.Team) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._Team(ctx, sel, v) +} + +func (ec *executionContext) marshalOTeamCollection2ᚖmodelᚐTeamCollection(ctx context.Context, sel ast.SelectionSet, v *model.TeamCollection) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._TeamCollection(ctx, sel, v) +} + +func (ec *executionContext) unmarshalOTeamMemberRole2ᚖmodelᚐTeamMemberRole(ctx context.Context, v interface{}) (*model.TeamMemberRole, error) { + if v == nil { + return nil, nil + } + tmp, err := graphql.UnmarshalString(v) + res := model.TeamMemberRole(tmp) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOTeamMemberRole2ᚖmodelᚐTeamMemberRole(ctx context.Context, sel ast.SelectionSet, v *model.TeamMemberRole) graphql.Marshaler { + if v == nil { + return graphql.Null + } + res := graphql.MarshalString(string(*v)) + return res +} + +func (ec *executionContext) marshalOTeamRequest2ᚖmodelᚐTeamRequest(ctx context.Context, sel ast.SelectionSet, v *model.TeamRequest) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._TeamRequest(ctx, sel, v) +} + +func (ec *executionContext) marshalOUserCollection2ᚖmodelᚐUserCollection(ctx context.Context, sel ast.SelectionSet, v *model.UserCollection) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._UserCollection(ctx, sel, v) +} + +func (ec *executionContext) marshalOUserRequest2ᚖmodelᚐUserRequest(ctx context.Context, sel ast.SelectionSet, v *model.UserRequest) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._UserRequest(ctx, sel, v) +} + +func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Schema(ctx, sel, v) +} + +func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec.___Type(ctx, sel, v) +} + +// endregion ***************************** type.gotpl ***************************** diff --git a/internal/graph/go.mod b/internal/graph/go.mod new file mode 100644 index 0000000..07aff74 --- /dev/null +++ b/internal/graph/go.mod @@ -0,0 +1,24 @@ +module graph + +go 1.21.5 + +require ( + github.com/99designs/gqlgen v0.17.42 + github.com/google/uuid v1.5.0 + github.com/lucsky/cuid v1.2.1 + github.com/moby/pubsub v1.0.0 + github.com/rs/zerolog v1.31.0 + github.com/vektah/gqlparser/v2 v2.5.10 + golang.org/x/text v0.14.0 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/agnivade/levenshtein v1.1.1 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/sosodev/duration v1.1.0 // indirect + golang.org/x/sys v0.13.0 // indirect +) diff --git a/internal/graph/prelaod.go b/internal/graph/prelaod.go new file mode 100644 index 0000000..57f7d57 --- /dev/null +++ b/internal/graph/prelaod.go @@ -0,0 +1,44 @@ +package graph + +import ( + "context" + + "github.com/99designs/gqlgen/graphql" + "golang.org/x/text/cases" + "golang.org/x/text/language" + "gorm.io/gorm" +) + +func GetPreloadedDB(db *gorm.DB, ctx context.Context) *gorm.DB { + for _, c := range GetPreloads(ctx) { + db = db.Preload(c) + } + return db +} + +func GetPreloads(ctx context.Context) []string { + return GetNestedPreloads( + graphql.GetOperationContext(ctx), + graphql.CollectFieldsCtx(ctx, nil), + "", + ) +} + +func GetNestedPreloads(ctx *graphql.OperationContext, fields []graphql.CollectedField, prefix string) (preloads []string) { + for _, column := range fields { + prefixColumn := GetPreloadString(prefix, cases.Title(language.English).String(column.Name)) + children := graphql.CollectFields(ctx, column.Selections, nil) + if len(children) > 0 { + preloads = append(preloads, prefixColumn) + preloads = append(preloads, GetNestedPreloads(ctx, children, prefixColumn)...) + } + } + return +} + +func GetPreloadString(prefix, name string) string { + if len(prefix) > 0 { + return prefix + "." + name + } + return name +} diff --git a/internal/graph/pubsub.go b/internal/graph/pubsub.go new file mode 100644 index 0000000..39140a9 --- /dev/null +++ b/internal/graph/pubsub.go @@ -0,0 +1,185 @@ +package graph + +import ( + "time" + + "github.com/moby/pubsub" +) + +var ( + // UserUpdated chan *model.User + // UserDeleted chan *model.User + // TeamMemberAdded chan *model.TeamMember + // TeamMemberUpdated chan *model.TeamMember + // TeamMemberRemoved chan string + // TeamCollectionAdded chan *model.TeamCollection + // TeamCollectionUpdated chan *model.TeamCollection + // TeamCollectionRemoved chan string + // TeamCollectionMoved chan *model.TeamCollection + // CollectionOrderUpdated chan *dto.CollectionReorderData + // TeamRequestAdded chan *model.TeamRequest + // TeamRequestUpdated chan *model.TeamRequest + // TeamRequestDeleted chan string + // RequestOrderUpdated chan *dto.RequestReorderData + // RequestMoved chan *model.TeamRequest + // TeamInvitationAdded chan *model.TeamInvitation + // TeamInvitationRemoved chan string + // TeamEnvironmentUpdated chan *model.TeamEnvironment + // TeamEnvironmentCreated chan *model.TeamEnvironment + // TeamEnvironmentDeleted chan *model.TeamEnvironment + // UserSettingsCreated chan *model.UserSetting + // UserSettingsUpdated chan *model.UserSetting + // UserEnvironmentCreated chan *model.UserEnvironment + // UserEnvironmentUpdated chan *model.UserEnvironment + // UserEnvironmentDeleted chan *model.UserEnvironment + // UserEnvironmentDeleteMany chan int + // UserHistoryCreated chan *model.UserHistory + // UserHistoryUpdated chan *model.UserHistory + // UserHistoryDeleted chan *model.UserHistory + // UserHistoryDeletedMany chan *dto.UserHistoryDeletedManyData + // UserRequestCreated chan *model.UserRequest + // UserRequestUpdated chan *model.UserRequest + // UserRequestDeleted chan *model.UserRequest + // UserRequestMoved chan *dto.UserRequestReorderData + // UserCollectionCreated chan *model.UserCollection + // UserCollectionUpdated chan *model.UserCollection + // UserCollectionRemoved chan *dto.UserCollectionRemovedData + // UserCollectionMoved chan *model.UserCollection + // UserCollectionOrderUpdated chan *dto.UserCollectionReorderData + // MyShortcodesCreated chan *model.Shortcode + // MyShortcodesUpdated chan *model.Shortcode + // MyShortcodesRevoked chan *model.Shortcode + + UserUpdatedSub *pubsub.Publisher + UserDeletedSub *pubsub.Publisher + UserInvitedSub *pubsub.Publisher + TeamMemberAddedSub *pubsub.Publisher + TeamMemberUpdatedSub *pubsub.Publisher + TeamMemberRemovedSub *pubsub.Publisher + TeamCollectionAddedSub *pubsub.Publisher + TeamCollectionUpdatedSub *pubsub.Publisher + TeamCollectionRemovedSub *pubsub.Publisher + TeamCollectionMovedSub *pubsub.Publisher + CollectionOrderUpdatedSub *pubsub.Publisher + TeamRequestAddedSub *pubsub.Publisher + TeamRequestUpdatedSub *pubsub.Publisher + TeamRequestDeletedSub *pubsub.Publisher + RequestOrderUpdatedSub *pubsub.Publisher + RequestMovedSub *pubsub.Publisher + TeamInvitationAddedSub *pubsub.Publisher + TeamInvitationRemovedSub *pubsub.Publisher + TeamEnvironmentUpdatedSub *pubsub.Publisher + TeamEnvironmentCreatedSub *pubsub.Publisher + TeamEnvironmentDeletedSub *pubsub.Publisher + UserSettingsCreatedSub *pubsub.Publisher + UserSettingsUpdatedSub *pubsub.Publisher + UserEnvironmentCreatedSub *pubsub.Publisher + UserEnvironmentUpdatedSub *pubsub.Publisher + UserEnvironmentDeletedSub *pubsub.Publisher + UserEnvironmentDeleteManySub *pubsub.Publisher + UserHistoryCreatedSub *pubsub.Publisher + UserHistoryUpdatedSub *pubsub.Publisher + UserHistoryDeletedSub *pubsub.Publisher + UserHistoryDeletedManySub *pubsub.Publisher + UserRequestCreatedSub *pubsub.Publisher + UserRequestUpdatedSub *pubsub.Publisher + UserRequestDeletedSub *pubsub.Publisher + UserRequestMovedSub *pubsub.Publisher + UserCollectionCreatedSub *pubsub.Publisher + UserCollectionUpdatedSub *pubsub.Publisher + UserCollectionRemovedSub *pubsub.Publisher + UserCollectionMovedSub *pubsub.Publisher + UserCollectionOrderUpdatedSub *pubsub.Publisher + MyShortcodesCreatedSub *pubsub.Publisher + MyShortcodesUpdatedSub *pubsub.Publisher + MyShortcodesRevokedSub *pubsub.Publisher +) + +func init() { + // UserUpdated = make(chan *model.User) + // UserDeleted = make(chan *model.User) + // TeamMemberAdded = make(chan *model.TeamMember) + // TeamMemberUpdated = make(chan *model.TeamMember) + // TeamMemberRemoved = make(chan string) + // TeamCollectionAdded = make(chan *model.TeamCollection) + // TeamCollectionUpdated = make(chan *model.TeamCollection) + // TeamCollectionRemoved = make(chan string) + // TeamCollectionMoved = make(chan *model.TeamCollection) + // CollectionOrderUpdated = make(chan *dto.CollectionReorderData) + // TeamRequestAdded = make(chan *model.TeamRequest) + // TeamRequestUpdated = make(chan *model.TeamRequest) + // TeamRequestDeleted = make(chan string) + // RequestOrderUpdated = make(chan *dto.RequestReorderData) + // RequestMoved = make(chan *model.TeamRequest) + // TeamInvitationAdded = make(chan *model.TeamInvitation) + // TeamInvitationRemoved = make(chan string) + // TeamEnvironmentUpdated = make(chan *model.TeamEnvironment) + // TeamEnvironmentCreated = make(chan *model.TeamEnvironment) + // TeamEnvironmentDeleted = make(chan *model.TeamEnvironment) + // UserSettingsCreated = make(chan *model.UserSetting) + // UserSettingsUpdated = make(chan *model.UserSetting) + // UserEnvironmentCreated = make(chan *model.UserEnvironment) + // UserEnvironmentUpdated = make(chan *model.UserEnvironment) + // UserEnvironmentDeleted = make(chan *model.UserEnvironment) + // UserEnvironmentDeleteMany = make(chan int) + // UserHistoryCreated = make(chan *model.UserHistory) + // UserHistoryUpdated = make(chan *model.UserHistory) + // UserHistoryDeleted = make(chan *model.UserHistory) + // UserHistoryDeletedMany = make(chan *dto.UserHistoryDeletedManyData) + // UserRequestCreated = make(chan *model.UserRequest) + // UserRequestUpdated = make(chan *model.UserRequest) + // UserRequestDeleted = make(chan *model.UserRequest) + // UserRequestMoved = make(chan *dto.UserRequestReorderData) + // UserCollectionCreated = make(chan *model.UserCollection) + // UserCollectionUpdated = make(chan *model.UserCollection) + // UserCollectionRemoved = make(chan *dto.UserCollectionRemovedData) + // UserCollectionMoved = make(chan *model.UserCollection) + // UserCollectionOrderUpdated = make(chan *dto.UserCollectionReorderData) + // MyShortcodesCreated = make(chan *model.Shortcode) + // MyShortcodesUpdated = make(chan *model.Shortcode) + // MyShortcodesRevoked = make(chan *model.Shortcode) + + UserUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserDeletedSub = pubsub.NewPublisher(time.Second, 10) + UserInvitedSub = pubsub.NewPublisher(time.Second, 10) + TeamMemberAddedSub = pubsub.NewPublisher(time.Second, 10) + TeamMemberUpdatedSub = pubsub.NewPublisher(time.Second, 10) + TeamMemberRemovedSub = pubsub.NewPublisher(time.Second, 10) + TeamCollectionAddedSub = pubsub.NewPublisher(time.Second, 10) + TeamCollectionUpdatedSub = pubsub.NewPublisher(time.Second, 10) + TeamCollectionRemovedSub = pubsub.NewPublisher(time.Second, 10) + TeamCollectionMovedSub = pubsub.NewPublisher(time.Second, 10) + CollectionOrderUpdatedSub = pubsub.NewPublisher(time.Second, 10) + TeamRequestAddedSub = pubsub.NewPublisher(time.Second, 10) + TeamRequestUpdatedSub = pubsub.NewPublisher(time.Second, 10) + TeamRequestDeletedSub = pubsub.NewPublisher(time.Second, 10) + RequestOrderUpdatedSub = pubsub.NewPublisher(time.Second, 10) + RequestMovedSub = pubsub.NewPublisher(time.Second, 10) + TeamInvitationAddedSub = pubsub.NewPublisher(time.Second, 10) + TeamInvitationRemovedSub = pubsub.NewPublisher(time.Second, 10) + TeamEnvironmentUpdatedSub = pubsub.NewPublisher(time.Second, 10) + TeamEnvironmentCreatedSub = pubsub.NewPublisher(time.Second, 10) + TeamEnvironmentDeletedSub = pubsub.NewPublisher(time.Second, 10) + UserSettingsCreatedSub = pubsub.NewPublisher(time.Second, 10) + UserSettingsUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserEnvironmentCreatedSub = pubsub.NewPublisher(time.Second, 10) + UserEnvironmentUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserEnvironmentDeletedSub = pubsub.NewPublisher(time.Second, 10) + UserEnvironmentDeleteManySub = pubsub.NewPublisher(time.Second, 10) + UserHistoryCreatedSub = pubsub.NewPublisher(time.Second, 10) + UserHistoryUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserHistoryDeletedSub = pubsub.NewPublisher(time.Second, 10) + UserHistoryDeletedManySub = pubsub.NewPublisher(time.Second, 10) + UserRequestCreatedSub = pubsub.NewPublisher(time.Second, 10) + UserRequestUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserRequestDeletedSub = pubsub.NewPublisher(time.Second, 10) + UserRequestMovedSub = pubsub.NewPublisher(time.Second, 10) + UserCollectionCreatedSub = pubsub.NewPublisher(time.Second, 10) + UserCollectionUpdatedSub = pubsub.NewPublisher(time.Second, 10) + UserCollectionRemovedSub = pubsub.NewPublisher(time.Second, 10) + UserCollectionMovedSub = pubsub.NewPublisher(time.Second, 10) + UserCollectionOrderUpdatedSub = pubsub.NewPublisher(time.Second, 10) + MyShortcodesCreatedSub = pubsub.NewPublisher(time.Second, 10) + MyShortcodesUpdatedSub = pubsub.NewPublisher(time.Second, 10) + MyShortcodesRevokedSub = pubsub.NewPublisher(time.Second, 10) +} diff --git a/internal/graph/resolver.go b/internal/graph/resolver.go new file mode 100644 index 0000000..766f00f --- /dev/null +++ b/internal/graph/resolver.go @@ -0,0 +1,11 @@ +package graph + +import "gorm.io/gorm" + +// This file will not be regenerated automatically. +// +// It serves as dependency injection for your app, add any dependencies you require here. + +type Resolver struct { + DB *gorm.DB +} diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go new file mode 100644 index 0000000..e2375c2 --- /dev/null +++ b/internal/graph/schema.resolvers.go @@ -0,0 +1,2105 @@ +package graph + +// This file will be automatically regenerated based on the schema, any resolver implementations +// will be copied through when generating and any unknown code will be moved to the end. +// Code generated by github.com/99designs/gqlgen version v0.17.42 + +import ( + "context" + "dto" + ex "exception" + "fmt" + "mail" + mw "middleware" + "model" + "os" + "strings" + + "github.com/google/uuid" + "github.com/lucsky/cuid" + "gorm.io/gorm" + "gorm.io/gorm/clause" +) + +func (r *mutationResolver) UpdateUserSessions(ctx context.Context, currentSession string, sessionType model.ReqType) (*model.User, error) { + // panic(fmt.Errorf("not implemented: UpdateUserSessions - updateUserSessions")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + switch sessionType { + case model.REST: + user.CurrentRESTSession = ¤tSession + case model.GQL: + user.CurrentGQLSession = ¤tSession + } + if err := r.DB.Save(user).Error; err != nil { + return nil, err + } + err := GetPreloadedDB(r.DB, ctx).First(user, `uid=?`, user.UID).Error + return user, err +} + +func (r *mutationResolver) DeleteUser(ctx context.Context) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteUser - deleteUser")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return false, ex.ErrBugAuthNoUserCtx + } + if err := r.DB.Delete(user).Error; err != nil { + return false, ex.ErrUserDeletionFailed + } + UserDeletedSub.Publish(user) + return true, nil +} + +func (r *mutationResolver) UpdateInfraConfigs(ctx context.Context, infraConfigs []*dto.InfraConfigArgs) (c []*model.InfraConfig, err error) { + // panic(fmt.Errorf("not implemented: UpdateInfraConfigs - updateInfraConfigs")) + tx := r.DB.Begin() + for _, cf := range infraConfigs { + cfg := &model.InfraConfig{} + err = tx.Model(cfg).Clauses(clause.Returning{}).Where("name=?", cf.Name).Update("Value", cf.Value).Error + if err != nil { + tx.Rollback() + return + } else { + c = append(c, cfg) + } + } + tx.Commit() + return +} + +func (r *mutationResolver) ResetInfraConfigs(ctx context.Context) (bool, error) { + panic(fmt.Errorf("not implemented: ResetInfraConfigs - resetInfraConfigs")) +} + +func (r *mutationResolver) EnableAndDisableSso(ctx context.Context, providerInfo []*dto.EnableAndDisableSSOArgs) (bool, error) { + panic(fmt.Errorf("not implemented: EnableAndDisableSso - enableAndDisableSSO")) +} + +func (r *mutationResolver) InviteNewUser(ctx context.Context, inviteeEmail string) (*model.InvitedUser, error) { + // panic(fmt.Errorf("not implemented: InviteNewUser - inviteNewUser")) + admin, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + iu := &model.InvitedUser{ + AdminUID: admin.UID, + AdminEmail: *admin.Email, + InviteeEmail: inviteeEmail, + Admin: *admin, + } + tx := r.DB.Begin() + if err := tx.Save(iu).Error; err != nil { + tx.Rollback() + return nil, err + } + magicLink := os.Getenv("VITE_BASE_URL") + if err := mail.SendUserInvitation(inviteeEmail, magicLink); err != nil { + tx.Rollback() + return nil, err + } + tx.Commit() + UserInvitedSub.Publish(iu) + return iu, nil +} + +func (r *mutationResolver) RemoveUserByAdmin(ctx context.Context, userUID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RemoveUserByAdmin - removeUserByAdmin")) + user := &model.User{} + if err := r.DB.First(user, "uid=?", userUID).Error; err != nil { + return false, ex.ErrUserNotFound + } + if err := r.DB.Delete(user).Error; err != nil { + return false, ex.ErrUserDeletionFailed + } + UserDeletedSub.Publish(user) + return true, nil +} + +func (r *mutationResolver) MakeUserAdmin(ctx context.Context, userUID string) (bool, error) { + // panic(fmt.Errorf("not implemented: MakeUserAdmin - makeUserAdmin")) + err := r.DB.Model(&model.User{}).Where("uid=?", userUID).Update("isAdmin", true).Error + return err == nil, err +} + +func (r *mutationResolver) RemoveUserAsAdmin(ctx context.Context, userUID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RemoveUserAsAdmin - removeUserAsAdmin")) + err := r.DB.Model(&model.User{}).Where("uid=?", userUID).Update("isAdmin", false).Error + return err == nil, err +} + +func (r *mutationResolver) CreateTeamByAdmin(ctx context.Context, userUID string, name string) (*model.Team, error) { + // panic(fmt.Errorf("not implemented: CreateTeamByAdmin - createTeamByAdmin")) + teamID := cuid.New() + member := &model.TeamMember{ + ID: uuid.NewString(), + TeamID: teamID, + UserUID: userUID, + Role: model.OWNER, + } + team := &model.Team{ + ID: teamID, + Name: name, + Members: []model.TeamMember{*member}, + } + if err := r.DB.Create(team).Error; err != nil { + return nil, err + } + // TeamMemberAddedSub.Publish(member) + return team, nil +} + +func (r *mutationResolver) ChangeUserRoleInTeamByAdmin(ctx context.Context, userUID string, teamID string, newRole model.TeamMemberRole) (*model.TeamMember, error) { + // panic(fmt.Errorf("not implemented: ChangeUserRoleInTeamByAdmin - changeUserRoleInTeamByAdmin")) + member := &model.TeamMember{} + if err := GetPreloadedDB(r.DB, ctx).Where(`"userUid"=? AND "teamID"=?`, userUID, teamID).First(member).Error; err != nil { + return nil, err + } + if err := r.DB.Model(member).Clauses(clause.Returning{}).Where( + `"userUid"=? AND "teamID"=?`, userUID, teamID, + ).Update( + "role", model.TeamMemberRole(newRole), + ).Error; err != nil { + return nil, err + } + TeamMemberUpdatedSub.Publish(member) + return member, nil +} + +func (r *mutationResolver) RemoveUserFromTeamByAdmin(ctx context.Context, userUID string, teamID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RemoveUserFromTeamByAdmin - removeUserFromTeamByAdmin")) + member := &model.TeamMember{} + if err := r.DB.Model(member).Clauses(clause.Returning{}).Where(`"userUid"=? AND "teamID"=?`, userUID, teamID).Delete(member).Error; err != nil { + return false, err + } + TeamMemberRemovedSub.Publish(member.ID) + return true, nil +} + +func (r *mutationResolver) AddUserToTeamByAdmin(ctx context.Context, teamID string, role model.TeamMemberRole, userEmail string) (*model.TeamMember, error) { + // panic(fmt.Errorf("not implemented: AddUserToTeamByAdmin - addUserToTeamByAdmin")) + user := &model.User{} + if err := r.DB.Model(&model.User{}).Find("email=?", userEmail).First(user).Error; err != nil { + return nil, ex.ErrUserNotFound + } + member := &model.TeamMember{} + if err := r.DB.First(member, `"userUid"=? AND "teamID"=?`, user.UID, teamID).Error; err != nil { + return nil, err + } + if member.UserUID != "" { + return nil, ex.ErrTeamInviteAlreadyMember + } + member.ID = uuid.NewString() + member.UserUID = user.UID + member.TeamID = teamID + member.User = *user + if err := r.DB.Create(member).Error; err != nil { + return nil, err + } + TeamMemberAddedSub.Publish(member) + return member, nil +} + +func (r *mutationResolver) RenameTeamByAdmin(ctx context.Context, teamID string, newName string) (*model.Team, error) { + // panic(fmt.Errorf("not implemented: RenameTeamByAdmin - renameTeamByAdmin")) + team := &model.Team{} + if err := GetPreloadedDB(r.DB, ctx).First(team, "id=?", teamID).Error; err != nil { + return nil, err + } + err := r.DB.Model(team).Clauses(clause.Returning{}).Where("id=?", teamID).Update("name", newName).Error + return team, err +} + +func (r *mutationResolver) DeleteTeamByAdmin(ctx context.Context, teamID string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteTeamByAdmin - deleteTeamByAdmin")) + err := r.DB.Delete(&model.Team{}, "id=?", teamID).Error + return err == nil, nil +} + +func (r *mutationResolver) RevokeTeamInviteByAdmin(ctx context.Context, inviteID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RevokeTeamInviteByAdmin - revokeTeamInviteByAdmin")) + if err := r.DB.Delete(&model.TeamInvitation{}, "id=?", inviteID).Error; err != nil { + return false, err + } + TeamInvitationRemovedSub.Publish(inviteID) + return true, nil +} + +func (r *mutationResolver) RevokeShortcodeByAdmin(ctx context.Context, code string) (bool, error) { + // panic(fmt.Errorf("not implemented: RevokeShortcodeByAdmin - revokeShortcodeByAdmin")) + sc := &model.Shortcode{} + if err := r.DB.Model(sc).Clauses(clause.Returning{}).Delete(sc, "id=?", code).Error; err != nil { + return false, err + } + MyShortcodesRevokedSub.Publish(sc) + return true, nil +} + +func (r *mutationResolver) CreateTeam(ctx context.Context, name string) (*model.Team, error) { + // panic(fmt.Errorf("not implemented: CreateTeam - createTeam")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + team, err := createTeam(r.DB, name, user.UID) + if err != nil { + return nil, err + } + TeamMemberAddedSub.Publish(&team.Members[0]) + return team, nil +} + +func (r *mutationResolver) LeaveTeam(ctx context.Context, teamID string) (bool, error) { + // panic(fmt.Errorf("not implemented: LeaveTeam - leaveTeam")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return false, ex.ErrBugAuthNoUserCtx + } + uid, err := removeTeamMember(r.DB, teamID, user.UID) + if err != nil { + return false, err + } + TeamMemberRemovedSub.Publish(uid) + return true, nil +} + +func (r *mutationResolver) RemoveTeamMember(ctx context.Context, teamID string, userUID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RemoveTeamMember - removeTeamMember")) + uid, err := removeTeamMember(r.DB, teamID, userUID) + if err != nil { + return false, err + } + TeamMemberRemovedSub.Publish(uid) + return true, nil +} + +func (r *mutationResolver) RenameTeam(ctx context.Context, teamID string, newName string) (*model.Team, error) { + // panic(fmt.Errorf("not implemented: RenameTeam - renameTeam")) + team := &model.Team{} + if err := GetPreloadedDB(r.DB, ctx).First(team, "id=?", teamID).Error; err != nil { + return nil, err + } + err := r.DB.Model(team).Clauses(clause.Returning{}).Where("id=?", teamID).Update("name", newName).Error + return team, err +} + +func (r *mutationResolver) DeleteTeam(ctx context.Context, teamID string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteTeam - deleteTeam")) + team := &model.Team{} + err := r.DB.Delete(team, "id=?", teamID).Error + return err == nil, err +} + +func (r *mutationResolver) UpdateTeamMemberRole(ctx context.Context, teamID string, userUID string, newRole model.TeamMemberRole) (*model.TeamMember, error) { + // panic(fmt.Errorf("not implemented: UpdateTeamMemberRole - updateTeamMemberRole")) + teamMember := &model.TeamMember{} + if err := GetPreloadedDB(r.DB, ctx).First(teamMember, `"teamID" = ? AND "userUid" = ?`, teamID, userUID).Error; err != nil { + return nil, err + } + teamMember.Role = newRole + if err := r.DB.Save(teamMember).Error; err != nil { + return nil, err + } + TeamMemberUpdatedSub.Publish(teamMember) + return teamMember, nil +} + +func (r *mutationResolver) CreateTeamInvitation(ctx context.Context, teamID string, inviteeEmail string, inviteeRole model.TeamMemberRole) (*model.TeamInvitation, error) { + // panic(fmt.Errorf("not implemented: CreateTeamInvitation - createTeamInvitation")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + team := &model.Team{} + if err := r.DB.First(team, "id=?", teamID).Error; err != nil { + return nil, err + } + invite := &model.TeamInvitation{ + ID: cuid.New(), + TeamID: teamID, + InviteeEmail: inviteeEmail, + InviteeRole: inviteeRole, + CreatorUID: user.UID, + } + tx := r.DB.Begin() + if err := tx.Create(invite).Error; err != nil { + tx.Rollback() + return nil, err + } + base_url := os.Getenv("VITE_BASE_URL") + url := fmt.Sprintf("%s/join-team?id=%s", base_url, invite.ID) + if err := mail.SendTeamInvitation(inviteeEmail, *user.DisplayName, team.Name, url); err != nil { + tx.Rollback() + return nil, err + } + tx.Commit() + if err := GetPreloadedDB(r.DB, ctx).First(invite, "id=?", invite.ID).Error; err != nil { + return nil, err + } + TeamInvitationAddedSub.Publish(invite) + return invite, nil +} + +func (r *mutationResolver) RevokeTeamInvitation(ctx context.Context, inviteID string) (bool, error) { + // panic(fmt.Errorf("not implemented: RevokeTeamInvitation - revokeTeamInvitation")) + if err := r.DB.Delete(&model.TeamInvitation{}, "id=?", inviteID).Error; err != nil { + return false, err + } + TeamInvitationRemovedSub.Publish(inviteID) + return true, nil +} + +func (r *mutationResolver) AcceptTeamInvitation(ctx context.Context, inviteID string) (*model.TeamMember, error) { + // panic(fmt.Errorf("not implemented: AcceptTeamInvitation - acceptTeamInvitation")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + invite := &model.TeamInvitation{} + if err := r.DB.First(invite, "id=?", inviteID).Error; err != nil { + return nil, err + } + member := &model.TeamMember{ + ID: cuid.New(), + TeamID: invite.TeamID, + UserUID: user.UID, + Role: invite.InviteeRole, + } + if err := r.DB.Create(member).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(member, "id=?", member.ID).Error; err != nil { + return nil, err + } + TeamMemberAddedSub.Publish(member) + return member, nil +} + +func (r *mutationResolver) CreateTeamEnvironment(ctx context.Context, name string, teamID string, variables string) (*model.TeamEnvironment, error) { + // panic(fmt.Errorf("not implemented: CreateTeamEnvironment - createTeamEnvironment")) + env := &model.TeamEnvironment{ + ID: cuid.New(), + TeamID: teamID, + Name: name, + Variables: variables, + } + if err := r.DB.Create(env).Error; err != nil { + return nil, err + } + team := &model.Team{} + if err := GetPreloadedDB(r.DB, ctx).First(team, "id=?", team.ID).Error; err != nil { + return nil, err + } + TeamEnvironmentCreatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) DeleteTeamEnvironment(ctx context.Context, id string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteTeamEnvironment - deleteTeamEnvironment")) + env := &model.TeamEnvironment{} + if err := r.DB.First(env, "id=?", id).Error; err != nil { + return false, err + } + if err := r.DB.Delete(env).Error; err != nil { + return false, err + } + TeamEnvironmentDeletedSub.Publish(env) + return true, nil +} + +func (r *mutationResolver) UpdateTeamEnvironment(ctx context.Context, id string, name string, variables string) (*model.TeamEnvironment, error) { + // panic(fmt.Errorf("not implemented: UpdateTeamEnvironment - updateTeamEnvironment")) + env := &model.TeamEnvironment{} + if err := GetPreloadedDB(r.DB, ctx).First(env, "id=?", id).Error; err != nil { + return nil, err + } + env.Name = name + env.Variables = variables + if err := r.DB.Save(env).Error; err != nil { + return nil, err + } + TeamEnvironmentUpdatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) DeleteAllVariablesFromTeamEnvironment(ctx context.Context, id string) (*model.TeamEnvironment, error) { + // panic(fmt.Errorf("not implemented: DeleteAllVariablesFromTeamEnvironment - deleteAllVariablesFromTeamEnvironment")) + env := &model.TeamEnvironment{} + if err := GetPreloadedDB(r.DB, ctx).First(env, "id=?", id).Error; err != nil { + return nil, err + } + env.Variables = "" + if err := r.DB.Save(env).Error; err != nil { + return nil, err + } + TeamEnvironmentUpdatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) CreateDuplicateEnvironment(ctx context.Context, id string) (*model.TeamEnvironment, error) { + // panic(fmt.Errorf("not implemented: CreateDuplicateEnvironment - createDuplicateEnvironment")) + env := &model.TeamEnvironment{} + if err := r.DB.First(env, "id=?", id).Error; err != nil { + return nil, err + } + dupEnv := &model.TeamEnvironment{ + ID: cuid.New(), + TeamID: env.TeamID, + Name: env.Name + " Copy", + Variables: env.Variables, + } + if err := r.DB.Create(dupEnv).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(dupEnv, "id=?", dupEnv.ID).Error; err != nil { + return nil, err + } + TeamEnvironmentCreatedSub.Publish(dupEnv) + return dupEnv, nil +} + +func (r *mutationResolver) CreateRootCollection(ctx context.Context, teamID string, title string, data *string) (*model.TeamCollection, error) { + // panic(fmt.Errorf("not implemented: CreateRootCollection - createRootCollection")) + coll := &model.TeamCollection{ + ID: cuid.New(), + TeamID: teamID, + Title: title, + OrderIndex: getTeamMaxOrderIndex(r.DB, &model.TeamCollection{}, &teamID, nil) + 1, + } + if err := r.DB.Create(coll).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + TeamCollectionAddedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) ImportCollectionsFromJSON(ctx context.Context, teamID string, jsonString string, parentCollectionID *string) (bool, error) { + panic(fmt.Errorf("not implemented: ImportCollectionsFromJSON - importCollectionsFromJSON")) +} + +func (r *mutationResolver) ReplaceCollectionsWithJSON(ctx context.Context, teamID string, jsonString string, parentCollectionID *string) (bool, error) { + panic(fmt.Errorf("not implemented: ReplaceCollectionsWithJSON - replaceCollectionsWithJSON")) +} + +func (r *mutationResolver) CreateChildCollection(ctx context.Context, collectionID string, childTitle string, data *string) (*model.TeamCollection, error) { + // panic(fmt.Errorf("not implemented: CreateChildCollection - createChildCollection")) + coll := &model.TeamCollection{} + if err := r.DB.First(coll, "id=?", collectionID).Error; err != nil { + return nil, err + } + child, err := createChildTeamCollection(r.DB, childTitle, data, *coll) + if err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(child, "id=?", child.ID).Error; err != nil { + return nil, err + } + TeamCollectionAddedSub.Publish(child) + return child, err +} + +func (r *mutationResolver) RenameCollection(ctx context.Context, collectionID string, newTitle string) (*model.TeamCollection, error) { + // panic(fmt.Errorf("not implemented: RenameCollection - renameCollection")) + coll := &model.TeamCollection{} + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", collectionID).Error; err != nil { + return nil, err + } + coll.Title = newTitle + if err := r.DB.Save(coll).Error; err != nil { + return nil, err + } + TeamCollectionUpdatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) DeleteCollection(ctx context.Context, collectionID string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteCollection - deleteCollection")) + if err := r.DB.Delete(&model.TeamCollection{}, "id=?", collectionID).Error; err != nil { + return false, err + } + TeamCollectionRemovedSub.Publish(collectionID) + return true, nil +} + +func (r *mutationResolver) MoveCollection(ctx context.Context, parentCollectionID *string, collectionID string) (*model.TeamCollection, error) { + // panic(fmt.Errorf("not implemented: MoveCollection - moveCollection")) + coll := &model.TeamCollection{} + if err := r.DB.First(coll, "id=?", collectionID).Error; err != nil { + return nil, err + } + if err := moveTeamCollection(r.DB, coll, parentCollectionID); err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + TeamCollectionMovedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) UpdateCollectionOrder(ctx context.Context, collectionID string, destCollID *string) (bool, error) { + // panic(fmt.Errorf("not implemented: UpdateCollectionOrder - updateCollectionOrder")) + coll := &model.TeamCollection{} + if err := r.DB.First(coll, "id=?", collectionID).Error; err != nil { + return false, err + } + destColl := &model.TeamCollection{} + if destCollID != nil { + if err := r.DB.First(destColl, "id=?", *destCollID).Error; err != nil { + return false, err + } + } + if dto, err := updateTeamCollectionOrder(r.DB, coll, destColl); err != nil { + return false, err + } else { + CollectionOrderUpdatedSub.Publish(dto) + } + return true, nil +} + +func (r *mutationResolver) UpdateTeamCollection(ctx context.Context, collectionID string, newTitle *string, data *string) (*model.TeamCollection, error) { + // panic(fmt.Errorf("not implemented: UpdateTeamCollection - updateTeamCollection")) + coll := &model.TeamCollection{} + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", collectionID).Error; err != nil { + return nil, err + } + if newTitle != nil { + coll.Title = *newTitle + } + if data != nil { + coll.Data = data + } + if err := r.DB.Save(coll).Error; err != nil { + return nil, err + } + TeamCollectionUpdatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) CreateRequestInCollection(ctx context.Context, collectionID string, data dto.CreateTeamRequestInput) (*model.TeamRequest, error) { + // panic(fmt.Errorf("not implemented: CreateRequestInCollection - createRequestInCollection")) + coll := &model.TeamCollection{} + if err := r.DB.First(coll, "id=?", collectionID).Error; err != nil { + return nil, err + } + req := &model.TeamRequest{ + ID: cuid.New(), + CollectionID: coll.ID, + TeamID: coll.TeamID, + Title: data.Title, + Request: data.Request, + OrderIndex: getTeamMaxOrderIndex(r.DB, &model.TeamRequest{}, &coll.TeamID, &coll.ID), + } + if err := r.DB.Create(req).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(req, "id=?", req.ID).Error; err != nil { + return nil, err + } + TeamRequestAddedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) UpdateRequest(ctx context.Context, requestID string, data dto.UpdateTeamRequestInput) (*model.TeamRequest, error) { + // panic(fmt.Errorf("not implemented: UpdateRequest - updateRequest")) + req := &model.TeamRequest{} + if err := GetPreloadedDB(r.DB, ctx).First(req, "id=?", requestID).Error; err != nil { + return nil, err + } + if data.Title != nil { + req.Title = *data.Title + } + if data.Request != nil { + req.Request = *data.Request + } + if err := r.DB.Save(req).Error; err != nil { + return nil, err + } + TeamRequestUpdatedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) DeleteRequest(ctx context.Context, requestID string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteRequest - deleteRequest")) + if err := r.DB.Delete(&model.TeamRequest{}, "id=?", requestID).Error; err != nil { + return false, err + } + TeamRequestDeletedSub.Publish(requestID) + return true, nil +} + +func (r *mutationResolver) UpdateLookUpRequestOrder(ctx context.Context, collectionID string, nextRequestID *string, requestID string) (bool, error) { + // panic(fmt.Errorf("not implemented: UpdateLookUpRequestOrder - updateLookUpRequestOrder")) + req := &model.TeamRequest{} + if err := r.DB.First(req, "id=?", requestID).Error; err != nil { + return false, err + } + var destReq *model.TeamRequest + if nextRequestID != nil { + if err := r.DB.First(destReq, "id=?", nextRequestID).Error; err != nil { + return false, err + } + } + dto, err := updateTeamRequestOrder(r.DB, req, destReq) + if err != nil { + return false, err + } + RequestOrderUpdatedSub.Publish(dto) + return true, nil +} + +func (r *mutationResolver) MoveRequest(ctx context.Context, srcCollID *string, requestID string, destCollID string, nextRequestID *string) (*model.TeamRequest, error) { + // panic(fmt.Errorf("not implemented: MoveRequest - moveRequest")) + req := &model.TeamRequest{} + if err := r.DB.First(req, "id=?", requestID).Error; err != nil { + return nil, err + } + if err := moveTeamRequest(r.DB, req, destCollID); err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(req, "id=?", req.ID).Error; err != nil { + return nil, err + } + RequestMovedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) CreateShortcode(ctx context.Context, request string, properties *string) (*model.Shortcode, error) { + // panic(fmt.Errorf("not implemented: CreateShortcode - createShortcode")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + shortcode := &model.Shortcode{ + ID: cuid.New(), + Request: request, + EmbedProperties: properties, + CreatorUID: &user.UID, + } + if err := r.DB.Create(shortcode).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(shortcode, "id=?", shortcode.ID).Error; err != nil { + return nil, err + } + MyShortcodesCreatedSub.Publish(shortcode) + return shortcode, nil +} + +func (r *mutationResolver) UpdateEmbedProperties(ctx context.Context, code string, properties string) (*model.Shortcode, error) { + // panic(fmt.Errorf("not implemented: UpdateEmbedProperties - updateEmbedProperties")) + shortcode := &model.Shortcode{} + if err := GetPreloadedDB(r.DB, ctx).First(shortcode, "id=?", code).Error; err != nil { + return nil, err + } + shortcode.EmbedProperties = &properties + if err := r.DB.Save(shortcode).Error; err != nil { + return nil, err + } + MyShortcodesUpdatedSub.Publish(shortcode) + return shortcode, nil +} + +func (r *mutationResolver) RevokeShortcode(ctx context.Context, code string) (bool, error) { + // panic(fmt.Errorf("not implemented: RevokeShortcode - revokeShortcode")) + shortcode := &model.Shortcode{} + if err := r.DB.First(shortcode, "id=?", code).Error; err != nil { + return false, err + } + if err := r.DB.Delete(shortcode).Error; err != nil { + return false, err + } + MyShortcodesRevokedSub.Publish(shortcode) + return true, nil +} + +func (r *mutationResolver) CreateUserSettings(ctx context.Context, properties string) (*model.UserSetting, error) { + // panic(fmt.Errorf("not implemented: CreateUserSettings - createUserSettings")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + setting := &model.UserSetting{ + ID: cuid.New(), + UserUID: user.UID, + Properties: properties, + } + if err := r.DB.Create(setting).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(setting, "id=?", setting.ID).Error; err != nil { + return nil, err + } + UserSettingsCreatedSub.Publish(setting) + return setting, nil +} + +func (r *mutationResolver) UpdateUserSettings(ctx context.Context, properties string) (*model.UserSetting, error) { + // panic(fmt.Errorf("not implemented: UpdateUserSettings - updateUserSettings")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + setting := &model.UserSetting{} + if err := GetPreloadedDB(r.DB, ctx).First(setting, `"userUid" = ?`, user.UID).Error; err != nil { + return nil, err + } + setting.Properties = properties + if err := r.DB.Save(setting).Error; err != nil { + return nil, err + } + UserSettingsUpdatedSub.Publish(setting) + return setting, nil +} + +func (r *mutationResolver) CreateUserEnvironment(ctx context.Context, name string, variables string) (*model.UserEnvironment, error) { + // panic(fmt.Errorf("not implemented: CreateUserEnvironment - createUserEnvironment")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + env := &model.UserEnvironment{ + ID: cuid.New(), + UserUID: user.UID, + Name: &name, + Variables: variables, + IsGlobal: false, + } + if err := r.DB.Create(env).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(env, "id=?", env.ID).Error; err != nil { + return nil, err + } + UserEnvironmentCreatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) CreateUserGlobalEnvironment(ctx context.Context, variables string) (*model.UserEnvironment, error) { + // panic(fmt.Errorf("not implemented: CreateUserGlobalEnvironment - createUserGlobalEnvironment")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + env := &model.UserEnvironment{ + ID: cuid.New(), + UserUID: user.UID, + Name: nil, + Variables: variables, + IsGlobal: true, + } + if err := r.DB.Create(env).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(env, "id=?", env.ID).Error; err != nil { + return nil, err + } + UserEnvironmentCreatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) UpdateUserEnvironment(ctx context.Context, id string, name string, variables string) (*model.UserEnvironment, error) { + // panic(fmt.Errorf("not implemented: UpdateUserEnvironment - updateUserEnvironment")) + env := &model.UserEnvironment{} + if err := GetPreloadedDB(r.DB, ctx).First(env, "id=?", env.ID).Error; err != nil { + return nil, err + } + env.Name = &name + env.Variables = variables + if err := r.DB.Save(env).Error; err != nil { + return nil, err + } + UserEnvironmentUpdatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) DeleteUserEnvironment(ctx context.Context, id string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteUserEnvironment - deleteUserEnvironment")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return false, ex.ErrBugAuthNoUserCtx + } + env := &model.UserEnvironment{} + if err := r.DB.Where(`id = ? AND "userUid" = ?`, id, user.UID).First(env).Error; err != nil { + return false, err + } + if err := r.DB.Delete(env).Error; err != nil { + return false, err + } + UserEnvironmentDeletedSub.Publish(env) + return true, nil +} + +func (r *mutationResolver) DeleteUserEnvironments(ctx context.Context) (int, error) { + // panic(fmt.Errorf("not implemented: DeleteUserEnvironments - deleteUserEnvironments")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return 0, ex.ErrBugAuthNoUserCtx + } + result := r.DB.Delete(&model.UserEnvironment{}, `"userUid" = ?`, user.UID) + count := int(result.RowsAffected) + if result.Error == nil { + UserEnvironmentDeleteManySub.Publish(count) + } + return count, result.Error +} + +func (r *mutationResolver) ClearGlobalEnvironments(ctx context.Context, id string) (*model.UserEnvironment, error) { + // panic(fmt.Errorf("not implemented: ClearGlobalEnvironments - clearGlobalEnvironments")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + env := &model.UserEnvironment{} + if err := GetPreloadedDB(r.DB, ctx).First(env, `id = ? AND "userUid" = ?`, id, user.UID).Error; err != nil { + return nil, err + } + env.Variables = "" + if err := r.DB.Save(env).Error; err != nil { + return nil, err + } + UserEnvironmentUpdatedSub.Publish(env) + return env, nil +} + +func (r *mutationResolver) CreateUserHistory(ctx context.Context, reqData string, resMetadata string, reqType model.ReqType) (*model.UserHistory, error) { + // panic(fmt.Errorf("not implemented: CreateUserHistory - createUserHistory")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + history := &model.UserHistory{ + ID: cuid.New(), + UserUID: user.UID, + ReqType: reqType, + Request: reqData, + ResponseMetadata: resMetadata, + IsStarred: false, + } + if err := r.DB.Create(history).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(history, "id=?", history.ID).Error; err != nil { + return nil, err + } + UserHistoryCreatedSub.Publish(history) + return history, nil +} + +func (r *mutationResolver) ToggleHistoryStarStatus(ctx context.Context, id string) (*model.UserHistory, error) { + // panic(fmt.Errorf("not implemented: ToggleHistoryStarStatus - toggleHistoryStarStatus")) + history := &model.UserHistory{} + if err := GetPreloadedDB(r.DB, ctx).First(history, "id=?", history.ID).Error; err != nil { + return nil, err + } + history.IsStarred = !history.IsStarred + if err := r.DB.Save(history).Error; err != nil { + return nil, err + } + UserHistoryCreatedSub.Publish(history) + return history, nil +} + +func (r *mutationResolver) RemoveRequestFromHistory(ctx context.Context, id string) (*model.UserHistory, error) { + // panic(fmt.Errorf("not implemented: RemoveRequestFromHistory - removeRequestFromHistory")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + history := &model.UserHistory{} + if err := GetPreloadedDB(r.DB, ctx).Where(`id = ? AND "userUid" = ?`, id, user.UID).First(history).Error; err != nil { + return nil, err + } + if err := r.DB.Delete(history).Error; err != nil { + return nil, err + } + UserHistoryDeletedSub.Publish(history) + return history, nil +} + +func (r *mutationResolver) DeleteAllUserHistory(ctx context.Context, reqType model.ReqType) (*dto.UserHistoryDeletedManyData, error) { + // panic(fmt.Errorf("not implemented: DeleteAllUserHistory - deleteAllUserHistory")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + result := r.DB.Delete(&model.UserHistory{}, `"userUid" = ? AND "reqType" = ?`, user.UID, reqType) + if result.Error != nil { + return nil, result.Error + } + dto := dto.UserHistoryDeletedManyData{ + Count: int(result.RowsAffected), + ReqType: reqType, + } + UserHistoryDeletedManySub.Publish(&dto) + return &dto, nil +} + +func (r *mutationResolver) CreateRESTUserRequest(ctx context.Context, collectionID string, title string, request string) (*model.UserRequest, error) { + // panic(fmt.Errorf("not implemented: CreateRESTUserRequest - createRESTUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserRequest{}, user.UID, &collectionID) + req := &model.UserRequest{ + ID: cuid.New(), + CollectionID: collectionID, + UserUID: user.UID, + Type: model.REST, + Title: title, + Request: request, + OrderIndex: latest + 1, + } + if err := r.DB.Create(req).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(req, "id=?", req.ID).Error; err != nil { + return nil, err + } + UserRequestCreatedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) CreateGQLUserRequest(ctx context.Context, collectionID string, title string, request string) (*model.UserRequest, error) { + // panic(fmt.Errorf("not implemented: CreateGQLUserRequest - createGQLUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserRequest{}, user.UID, &collectionID) + req := &model.UserRequest{ + ID: cuid.New(), + CollectionID: collectionID, + UserUID: user.UID, + Type: model.GQL, + Title: title, + Request: request, + OrderIndex: latest + 1, + } + if err := r.DB.Create(req).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(req, "id=?", req.ID).Error; err != nil { + return nil, err + } + UserRequestCreatedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) UpdateRESTUserRequest(ctx context.Context, id string, title *string, request *string) (*model.UserRequest, error) { + // panic(fmt.Errorf("not implemented: UpdateRESTUserRequest - updateRESTUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + req := &model.UserRequest{} + if err := GetPreloadedDB(r.DB, ctx).First(req, `id=? AND "userUid" = ?`, id, user.UID).Error; err != nil { + return nil, err + } + if title != nil { + req.Title = *title + } + if request != nil { + req.Request = *request + } + if err := r.DB.Save(req).Error; err != nil { + return nil, err + } + UserRequestUpdatedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) UpdateGQLUserRequest(ctx context.Context, id string, title *string, request *string) (*model.UserRequest, error) { + // panic(fmt.Errorf("not implemented: UpdateGQLUserRequest - updateGQLUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + req := &model.UserRequest{} + if err := GetPreloadedDB(r.DB, ctx).First(req, `id=? AND "userUid" = ?`, id, user.UID).Error; err != nil { + return nil, err + } + if title != nil { + req.Title = *title + } + if request != nil { + req.Request = *request + } + if err := r.DB.Save(req).Error; err != nil { + return nil, err + } + UserRequestUpdatedSub.Publish(req) + return req, nil +} + +func (r *mutationResolver) DeleteUserRequest(ctx context.Context, id string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteUserRequest - deleteUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return false, ex.ErrBugAuthNoUserCtx + } + req := &model.UserRequest{} + if err := r.DB.First(req, `id=? AND "userUid" = ?`, id, user.UID).Error; err != nil { + return false, err + } + if err := r.DB.Delete(req).Error; err != nil { + return false, err + } + UserRequestDeletedSub.Publish(req) + return true, nil +} + +func (r *mutationResolver) MoveUserRequest(ctx context.Context, sourceCollectionID string, requestID string, destinationCollectionID string, nextRequestID *string) (*model.UserRequest, error) { + // panic(fmt.Errorf("not implemented: MoveUserRequest - moveUserRequest")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + dto, err := moveUserRequest(r.DB, user.UID, sourceCollectionID, requestID, destinationCollectionID, nextRequestID) + if err != nil { + return nil, err + } + err = GetPreloadedDB(r.DB, ctx).Where(`"userUid" = ?`, user.UID).First(dto.Request, "id=?", requestID).Error + return dto.Request, err +} + +func (r *mutationResolver) CreateRESTRootUserCollection(ctx context.Context, title string, data *string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: CreateRESTRootUserCollection - createRESTRootUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserCollection{}, user.UID, nil) + coll := &model.UserCollection{ + ID: cuid.New(), + ParentID: nil, + UserUID: user.UID, + Title: title, + OrderIndex: latest + 1, + Type: model.REST, + Data: data, + } + if err := r.DB.Create(coll).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + UserCollectionCreatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) CreateGQLRootUserCollection(ctx context.Context, title string, data *string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: CreateGQLRootUserCollection - createGQLRootUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserCollection{}, user.UID, nil) + coll := &model.UserCollection{ + ID: cuid.New(), + ParentID: nil, + UserUID: user.UID, + Title: title, + OrderIndex: latest + 1, + Type: model.GQL, + Data: data, + } + if err := r.DB.Create(coll).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + UserCollectionCreatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) CreateGQLChildUserCollection(ctx context.Context, title string, parentUserCollectionID string, data *string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: CreateGQLChildUserCollection - createGQLChildUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserCollection{}, user.UID, &parentUserCollectionID) + coll := &model.UserCollection{ + ID: cuid.New(), + ParentID: &parentUserCollectionID, + UserUID: user.UID, + Title: title, + OrderIndex: latest + 1, + Type: model.GQL, + Data: data, + } + if err := r.DB.Create(coll).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + UserCollectionCreatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) CreateRESTChildUserCollection(ctx context.Context, title string, parentUserCollectionID string, data *string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: CreateRESTChildUserCollection - createRESTChildUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + latest := getUserMaxOrderIndex(r.DB, &model.UserCollection{}, user.UID, &parentUserCollectionID) + coll := &model.UserCollection{ + ID: cuid.New(), + ParentID: &parentUserCollectionID, + UserUID: user.UID, + Title: title, + OrderIndex: latest + 1, + Type: model.REST, + Data: data, + } + if err := r.DB.Create(coll).Error; err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + UserCollectionCreatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) RenameUserCollection(ctx context.Context, userCollectionID string, newTitle string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: RenameUserCollection - renameUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + coll := &model.UserCollection{} + if err := GetPreloadedDB(r.DB, ctx).Where(`id = ? AND "userUid" = ?`, userCollectionID, user.UID).First(coll).Error; err != nil { + return nil, err + } + coll.Title = newTitle + if err := r.DB.Save(coll).Error; err != nil { + return nil, err + } + UserCollectionUpdatedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) DeleteUserCollection(ctx context.Context, userCollectionID string) (bool, error) { + // panic(fmt.Errorf("not implemented: DeleteUserCollection - deleteUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return false, ex.ErrBugAuthNoUserCtx + } + coll := &model.UserCollection{} + if err := r.DB.Where(`id = ? AND "userUid" = ?`, userCollectionID, user.UID).First(coll).Error; err != nil { + return false, err + } + if err := r.DB.Delete(coll).Error; err != nil { + return false, err + } + UserCollectionRemovedSub.Publish(&dto.UserCollectionRemovedData{ + ID: coll.ID, + Type: coll.Type, + }) + return true, nil +} + +func (r *mutationResolver) MoveUserCollection(ctx context.Context, destCollectionID *string, userCollectionID string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: MoveUserCollection - moveUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + coll := &model.UserCollection{} + if err := r.DB.First(coll, `"userUid"=? AND id=?`, user.UID, userCollectionID).Error; err != nil { + return nil, err + } + if err := moveUserCollection(r.DB, coll, destCollectionID); err != nil { + return nil, err + } + if err := GetPreloadedDB(r.DB, ctx).First(coll, "id=?", coll.ID).Error; err != nil { + return nil, err + } + UserCollectionMovedSub.Publish(coll) + return coll, nil +} + +func (r *mutationResolver) UpdateUserCollectionOrder(ctx context.Context, collectionID string, nextCollectionID *string) (bool, error) { + // panic(fmt.Errorf("not implemented: UpdateUserCollectionOrder - updateUserCollectionOrder")) + coll := &model.UserCollection{} + nextColl := &model.UserCollection{} + if err := r.DB.First(coll, "id=?", collectionID).Error; err != nil { + return false, err + } + if nextCollectionID != nil { + if err := r.DB.First(nextColl, "id=?", *nextCollectionID).Error; err != nil { + return false, err + } + } else { + return false, fmt.Errorf("nextCollectionID is nil") + } + + tx := r.DB.Begin() + if coll.OrderIndex > nextColl.OrderIndex { + if err := tx.Model(coll).Where(`"parentID"=?`, nextColl.ParentID).Where(`"orderIndex">=?`, nextColl.OrderIndex).Where(`"orderIndex"?`, coll.OrderIndex).Where(`"orderIndex"<=?`, nextColl.OrderIndex).Update(`"orderIndex"`, gorm.Expr(`"orderIndex" - 1`)).Error; err != nil { + tx.Rollback() + return false, err + } + coll.OrderIndex = nextColl.OrderIndex + if err := tx.Save(coll).Error; err != nil { + tx.Rollback() + return false, err + } + } + tx.Commit() + UserCollectionMovedSub.Publish(coll) + return true, nil +} + +func (r *mutationResolver) ImportUserCollectionsFromJSON(ctx context.Context, jsonString string, reqType model.ReqType, parentCollectionID *string) (bool, error) { + panic(fmt.Errorf("not implemented: ImportUserCollectionsFromJSON - importUserCollectionsFromJSON")) +} + +func (r *mutationResolver) UpdateUserCollection(ctx context.Context, userCollectionID string, newTitle *string, data *string) (*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: UpdateUserCollection - updateUserCollection")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + coll := &model.UserCollection{} + if err := GetPreloadedDB(r.DB, ctx).First(coll, `"userUiid"=? AND id=?`, user.UID, userCollectionID).Error; err != nil { + return nil, err + } + if newTitle != nil { + coll.Title = *newTitle + } + if data != nil { + coll.Data = data + } + if err := r.DB.Save(coll).Error; err != nil { + return nil, err + } + UserCollectionUpdatedSub.Publish(coll) + return coll, nil +} + +func (r *queryResolver) Me(ctx context.Context) (*model.User, error) { + // panic(fmt.Errorf("not implemented: Me - me")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + err := GetPreloadedDB(r.DB, ctx).First(user, "uid=?", user.UID).Error + return user, err +} + +func (r *queryResolver) Infra(ctx context.Context) (*dto.Infra, error) { + panic(fmt.Errorf("not implemented: Infra - infra")) +} + +func (r *queryResolver) InfraConfigs(ctx context.Context, configNames []dto.InfraConfigEnum) (c []*model.InfraConfig, err error) { + // panic(fmt.Errorf("not implemented: InfraConfigs - infraConfigs")) + names := []string{} + for _, name := range configNames { + names = append(names, name.String()) + } + err = r.DB.Find(&c, "name in (?)", names).Error + return +} + +func (r *queryResolver) AllowedAuthProviders(ctx context.Context) ([]string, error) { + // panic(fmt.Errorf("not implemented: AllowedAuthProviders - allowedAuthProviders")) + providers := strings.Split(os.Getenv("VITE_ALLOWED_AUTH_PROVIDERS"), ",") + return providers, nil +} + +func (r *queryResolver) Admin(ctx context.Context) (*dto.Admin, error) { + // panic(fmt.Errorf("not implemented: Admin - admin")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + return &dto.Admin{ + UID: user.UID, + DisplayName: user.DisplayName, + Email: user.Email, + PhotoURL: user.PhotoURL, + CreatedOn: user.CreatedOn, + }, nil +} + +func (r *queryResolver) MyTeams(ctx context.Context, cursor *string) (t []*model.Team, err error) { + // panic(fmt.Errorf("not implemented: MyTeams - myTeams")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + member := &[]*model.TeamMember{} + if err := r.DB.Find(member, "userUid = ?", user.UID).Error; err != nil { + return nil, err + } + team_ids := []string{} + for _, m := range *member { + team_ids = append(team_ids, m.TeamID) + } + err = GetPreloadedDB(r.DB, ctx).Find(&t, "id in (?)", team_ids).Error + return +} + +func (r *queryResolver) Team(ctx context.Context, teamID string) (t *model.Team, err error) { + // panic(fmt.Errorf("not implemented: Team - team")) + err = GetPreloadedDB(r.DB, ctx).First(t, "id = ?", teamID).Error + return +} + +func (r *queryResolver) TeamInvitation(ctx context.Context, inviteID string) (i *model.TeamInvitation, err error) { + // panic(fmt.Errorf("not implemented: TeamInvitation - teamInvitation")) + err = GetPreloadedDB(r.DB, ctx).Find(&i, "id = ?", inviteID).Error + return +} + +func (r *queryResolver) ExportCollectionsToJSON(ctx context.Context, teamID string) (string, error) { + panic(fmt.Errorf("not implemented: ExportCollectionsToJSON - exportCollectionsToJSON")) +} + +func (r *queryResolver) RootCollectionsOfTeam(ctx context.Context, cursor *string, take *int, teamID string) (c []*model.TeamCollection, err error) { + // panic(fmt.Errorf("not implemented: RootCollectionsOfTeam - rootCollectionsOfTeam")) + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&c, "teamID = ?", teamID).Error + return +} + +func (r *queryResolver) Collection(ctx context.Context, collectionID string) (c *model.TeamCollection, err error) { + // panic(fmt.Errorf("not implemented: Collection - collection")) + err = GetPreloadedDB(r.DB, ctx).First(c, "id = ?", collectionID).Error + return +} + +func (r *queryResolver) SearchForRequest(ctx context.Context, cursor *string, take *int, teamID string, searchTerm string) (req []*model.TeamRequest, err error) { + // panic(fmt.Errorf("not implemented: SearchForRequest - searchForRequest")) + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&req).Error + return +} + +func (r *queryResolver) Request(ctx context.Context, requestID string) (req *model.TeamRequest, err error) { + // panic(fmt.Errorf("not implemented: Request - request")) + err = GetPreloadedDB(r.DB, ctx).First(req, "id = ?", requestID).Error + return +} + +func (r *queryResolver) RequestsInCollection(ctx context.Context, cursor *string, take *int, collectionID string) (req []*model.TeamRequest, err error) { + // panic(fmt.Errorf("not implemented: RequestsInCollection - requestsInCollection")) + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&req, "collectionID = ?", collectionID).Error + return +} + +func (r *queryResolver) Shortcode(ctx context.Context, code string) (s *model.Shortcode, err error) { + // panic(fmt.Errorf("not implemented: Shortcode - shortcode")) + err = GetPreloadedDB(r.DB, ctx).First(s, "id = ?", code).Error + return +} + +func (r *queryResolver) MyShortcodes(ctx context.Context, cursor *string, take *int) (s []*model.Shortcode, err error) { + // panic(fmt.Errorf("not implemented: MyShortcodes - myShortcodes")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&s, "creatorUid = ?", user.UID).Error + return +} + +func (r *queryResolver) UserRESTRequests(ctx context.Context, cursor *string, take *int, collectionID *string) (c []*model.UserRequest, err error) { + // panic(fmt.Errorf("not implemented: UserRESTRequests - userRESTRequests")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + base := GetPreloadedDB(r.DB, ctx).Where("collectionID = ? AND userUid = ? AND type = ?", collectionID, user.UID, model.REST) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&c).Error + return +} + +func (r *queryResolver) UserGQLRequests(ctx context.Context, cursor *string, take *int, collectionID *string) (c []*model.UserRequest, err error) { + // panic(fmt.Errorf("not implemented: UserGQLRequests - userGQLRequests")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + base := GetPreloadedDB(r.DB, ctx).Where("collectionID = ? AND userUid = ? AND type = ?", collectionID, user.UID, model.GQL) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&c).Error + return +} + +func (r *queryResolver) UserRequest(ctx context.Context, id string) (req *model.UserRequest, err error) { + // panic(fmt.Errorf("not implemented: UserRequest - userRequest")) + err = GetPreloadedDB(r.DB, ctx).First(req, "id = ?", id).Error + return +} + +func (r *queryResolver) RootRESTUserCollections(ctx context.Context, cursor *string, take *int) (c []*model.UserCollection, err error) { + // panic(fmt.Errorf("not implemented: RootRESTUserCollections - rootRESTUserCollections")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + base := GetPreloadedDB(r.DB, ctx).Where("collectionID IS NULL AND userUid = ? AND type = ?", user.UID, model.REST) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&c).Error + return +} + +func (r *queryResolver) RootGQLUserCollections(ctx context.Context, cursor *string, take *int) (c []*model.UserCollection, err error) { + // panic(fmt.Errorf("not implemented: RootGQLUserCollections - rootGQLUserCollections")) + user, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + base := GetPreloadedDB(r.DB, ctx).Where("collectionID IS NULL AND userUid = ? AND type = ?", user.UID, model.GQL) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&c).Error + return +} + +func (r *queryResolver) UserCollection(ctx context.Context, userCollectionID string) (c *model.UserCollection, err error) { + // panic(fmt.Errorf("not implemented: UserCollection - userCollection")) + err = GetPreloadedDB(r.DB, ctx).First(c, "id = ?", userCollectionID).Error + return +} + +func (r *queryResolver) ExportUserCollectionsToJSON(ctx context.Context, collectionID *string, collectionType model.ReqType) (*dto.UserCollectionExportJSONData, error) { + panic(fmt.Errorf("not implemented: ExportUserCollectionsToJSON - exportUserCollectionsToJSON")) +} + +func (r *subscriptionResolver) UserUpdated(ctx context.Context) (<-chan *model.User, error) { + ch := make(chan *model.User) + go func() { + defer close(ch) + for e := range UserUpdatedSub.Subscribe() { + ch <- e.(*model.User) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserDeleted(ctx context.Context) (<-chan *model.User, error) { + ch := make(chan *model.User) + go func() { + defer close(ch) + for e := range UserDeletedSub.Subscribe() { + ch <- e.(*model.User) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserInvited(ctx context.Context) (<-chan *model.InvitedUser, error) { + ch := make(chan *model.InvitedUser) + go func() { + defer close(ch) + for e := range UserInvitedSub.Subscribe() { + ch <- e.(*model.InvitedUser) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamMemberAdded(ctx context.Context, teamID string) (<-chan *model.TeamMember, error) { + ch := make(chan *model.TeamMember) + go func() { + defer close(ch) + for e := range TeamMemberAddedSub.Subscribe() { + ch <- e.(*model.TeamMember) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamMemberUpdated(ctx context.Context, teamID string) (<-chan *model.TeamMember, error) { + ch := make(chan *model.TeamMember) + go func() { + defer close(ch) + for e := range TeamMemberUpdatedSub.Subscribe() { + ch <- e.(*model.TeamMember) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamMemberRemoved(ctx context.Context, teamID string) (<-chan string, error) { + ch := make(chan string) + go func() { + defer close(ch) + for e := range TeamMemberRemovedSub.Subscribe() { + ch <- e.(string) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamInvitationAdded(ctx context.Context, teamID string) (<-chan *model.TeamInvitation, error) { + ch := make(chan *model.TeamInvitation) + go func() { + defer close(ch) + for e := range TeamInvitationAddedSub.Subscribe() { + ch <- e.(*model.TeamInvitation) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamInvitationRemoved(ctx context.Context, teamID string) (<-chan string, error) { + ch := make(chan string) + go func() { + defer close(ch) + for e := range TeamInvitationRemovedSub.Subscribe() { + ch <- e.(string) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamEnvironmentUpdated(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) { + ch := make(chan *model.TeamEnvironment) + go func() { + defer close(ch) + for e := range TeamEnvironmentUpdatedSub.Subscribe() { + ch <- e.(*model.TeamEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamEnvironmentCreated(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) { + ch := make(chan *model.TeamEnvironment) + go func() { + defer close(ch) + for e := range TeamEnvironmentCreatedSub.Subscribe() { + ch <- e.(*model.TeamEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamEnvironmentDeleted(ctx context.Context, teamID string) (<-chan *model.TeamEnvironment, error) { + ch := make(chan *model.TeamEnvironment) + go func() { + defer close(ch) + for e := range TeamEnvironmentDeletedSub.Subscribe() { + ch <- e.(*model.TeamEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamCollectionAdded(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) { + ch := make(chan *model.TeamCollection) + go func() { + defer close(ch) + for e := range TeamCollectionAddedSub.Subscribe() { + ch <- e.(*model.TeamCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamCollectionUpdated(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) { + ch := make(chan *model.TeamCollection) + go func() { + defer close(ch) + for e := range TeamCollectionUpdatedSub.Subscribe() { + ch <- e.(*model.TeamCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamCollectionRemoved(ctx context.Context, teamID string) (<-chan string, error) { + ch := make(chan string) + go func() { + defer close(ch) + for e := range TeamCollectionRemovedSub.Subscribe() { + ch <- e.(string) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamCollectionMoved(ctx context.Context, teamID string) (<-chan *model.TeamCollection, error) { + ch := make(chan *model.TeamCollection) + go func() { + defer close(ch) + for e := range TeamCollectionMovedSub.Subscribe() { + ch <- e.(*model.TeamCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) CollectionOrderUpdated(ctx context.Context, teamID string) (<-chan *dto.CollectionReorderData, error) { + ch := make(chan *dto.CollectionReorderData) + go func() { + defer close(ch) + for e := range CollectionOrderUpdatedSub.Subscribe() { + ch <- e.(*dto.CollectionReorderData) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamRequestAdded(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) { + ch := make(chan *model.TeamRequest) + go func() { + defer close(ch) + for e := range TeamRequestAddedSub.Subscribe() { + ch <- e.(*model.TeamRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamRequestUpdated(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) { + ch := make(chan *model.TeamRequest) + go func() { + defer close(ch) + for e := range TeamRequestUpdatedSub.Subscribe() { + ch <- e.(*model.TeamRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) TeamRequestDeleted(ctx context.Context, teamID string) (<-chan string, error) { + ch := make(chan string) + go func() { + defer close(ch) + for e := range TeamRequestDeletedSub.Subscribe() { + ch <- e.(string) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) RequestOrderUpdated(ctx context.Context, teamID string) (<-chan *dto.RequestReorderData, error) { + ch := make(chan *dto.RequestReorderData) + go func() { + defer close(ch) + for e := range RequestOrderUpdatedSub.Subscribe() { + ch <- e.(*dto.RequestReorderData) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) RequestMoved(ctx context.Context, teamID string) (<-chan *model.TeamRequest, error) { + ch := make(chan *model.TeamRequest) + go func() { + defer close(ch) + for e := range RequestMovedSub.Subscribe() { + ch <- e.(*model.TeamRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) MyShortcodesCreated(ctx context.Context) (<-chan *model.Shortcode, error) { + ch := make(chan *model.Shortcode) + go func() { + defer close(ch) + for e := range MyShortcodesCreatedSub.Subscribe() { + ch <- e.(*model.Shortcode) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) MyShortcodesUpdated(ctx context.Context) (<-chan *model.Shortcode, error) { + ch := make(chan *model.Shortcode) + go func() { + defer close(ch) + for e := range MyShortcodesUpdatedSub.Subscribe() { + ch <- e.(*model.Shortcode) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) MyShortcodesRevoked(ctx context.Context) (<-chan *model.Shortcode, error) { + ch := make(chan *model.Shortcode) + go func() { + defer close(ch) + for e := range MyShortcodesRevokedSub.Subscribe() { + ch <- e.(*model.Shortcode) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserSettingsCreated(ctx context.Context) (<-chan *model.UserSetting, error) { + ch := make(chan *model.UserSetting) + go func() { + defer close(ch) + for e := range UserSettingsCreatedSub.Subscribe() { + ch <- e.(*model.UserSetting) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserSettingsUpdated(ctx context.Context) (<-chan *model.UserSetting, error) { + ch := make(chan *model.UserSetting) + go func() { + defer close(ch) + for e := range UserSettingsUpdatedSub.Subscribe() { + ch <- e.(*model.UserSetting) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserEnvironmentCreated(ctx context.Context) (<-chan *model.UserEnvironment, error) { + ch := make(chan *model.UserEnvironment) + go func() { + defer close(ch) + for e := range UserEnvironmentCreatedSub.Subscribe() { + ch <- e.(*model.UserEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserEnvironmentUpdated(ctx context.Context) (<-chan *model.UserEnvironment, error) { + ch := make(chan *model.UserEnvironment) + go func() { + defer close(ch) + for e := range UserEnvironmentUpdatedSub.Subscribe() { + ch <- e.(*model.UserEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserEnvironmentDeleted(ctx context.Context) (<-chan *model.UserEnvironment, error) { + ch := make(chan *model.UserEnvironment) + go func() { + defer close(ch) + for e := range UserEnvironmentDeletedSub.Subscribe() { + ch <- e.(*model.UserEnvironment) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserEnvironmentDeleteMany(ctx context.Context) (<-chan int, error) { + ch := make(chan int) + go func() { + defer close(ch) + for e := range UserEnvironmentDeleteManySub.Subscribe() { + ch <- e.(int) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserHistoryCreated(ctx context.Context) (<-chan *model.UserHistory, error) { + ch := make(chan *model.UserHistory) + go func() { + defer close(ch) + for e := range UserHistoryCreatedSub.Subscribe() { + ch <- e.(*model.UserHistory) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserHistoryUpdated(ctx context.Context) (<-chan *model.UserHistory, error) { + ch := make(chan *model.UserHistory) + go func() { + defer close(ch) + for e := range UserHistoryUpdatedSub.Subscribe() { + ch <- e.(*model.UserHistory) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserHistoryDeleted(ctx context.Context) (<-chan *model.UserHistory, error) { + ch := make(chan *model.UserHistory) + go func() { + defer close(ch) + for e := range UserHistoryDeletedSub.Subscribe() { + ch <- e.(*model.UserHistory) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserHistoryDeletedMany(ctx context.Context) (<-chan *dto.UserHistoryDeletedManyData, error) { + ch := make(chan *dto.UserHistoryDeletedManyData) + go func() { + defer close(ch) + for e := range UserHistoryDeletedManySub.Subscribe() { + ch <- e.(*dto.UserHistoryDeletedManyData) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserRequestCreated(ctx context.Context) (<-chan *model.UserRequest, error) { + ch := make(chan *model.UserRequest) + go func() { + defer close(ch) + for e := range UserRequestCreatedSub.Subscribe() { + ch <- e.(*model.UserRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserRequestUpdated(ctx context.Context) (<-chan *model.UserRequest, error) { + ch := make(chan *model.UserRequest) + go func() { + defer close(ch) + for e := range UserRequestUpdatedSub.Subscribe() { + ch <- e.(*model.UserRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserRequestDeleted(ctx context.Context) (<-chan *model.UserRequest, error) { + ch := make(chan *model.UserRequest) + go func() { + defer close(ch) + for e := range UserRequestDeletedSub.Subscribe() { + ch <- e.(*model.UserRequest) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserRequestMoved(ctx context.Context) (<-chan *dto.UserRequestReorderData, error) { + ch := make(chan *dto.UserRequestReorderData) + go func() { + defer close(ch) + for e := range UserRequestMovedSub.Subscribe() { + ch <- e.(*dto.UserRequestReorderData) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserCollectionCreated(ctx context.Context) (<-chan *model.UserCollection, error) { + ch := make(chan *model.UserCollection) + go func() { + defer close(ch) + for e := range UserCollectionCreatedSub.Subscribe() { + ch <- e.(*model.UserCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserCollectionUpdated(ctx context.Context) (<-chan *model.UserCollection, error) { + ch := make(chan *model.UserCollection) + go func() { + defer close(ch) + for e := range UserCollectionUpdatedSub.Subscribe() { + ch <- e.(*model.UserCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserCollectionRemoved(ctx context.Context) (<-chan *dto.UserCollectionRemovedData, error) { + ch := make(chan *dto.UserCollectionRemovedData) + go func() { + defer close(ch) + for e := range UserCollectionRemovedSub.Subscribe() { + ch <- e.(*dto.UserCollectionRemovedData) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserCollectionMoved(ctx context.Context) (<-chan *model.UserCollection, error) { + ch := make(chan *model.UserCollection) + go func() { + defer close(ch) + for e := range UserCollectionMovedSub.Subscribe() { + ch <- e.(*model.UserCollection) + } + }() + return ch, nil +} + +func (r *subscriptionResolver) UserCollectionOrderUpdated(ctx context.Context) (<-chan *dto.UserCollectionReorderData, error) { + ch := make(chan *dto.UserCollectionReorderData) + go func() { + defer close(ch) + for e := range UserCollectionOrderUpdatedSub.Subscribe() { + ch <- e.(*dto.UserCollectionReorderData) + } + }() + return ch, nil +} + +func (r *teamResolver) TeamMembers(ctx context.Context, obj *model.Team) (m []*model.TeamMember, err error) { + // panic(fmt.Errorf("not implemented: TeamMembers - teamMembers")) + err = GetPreloadedDB(r.DB, ctx).Find(&m, `"teamID"=?`, obj.ID).Error + return +} + +func (r *teamResolver) MyRole(ctx context.Context, obj *model.Team) (*model.TeamMemberRole, error) { + // panic(fmt.Errorf("not implemented: MyRole - myRole")) + operator, ok := ctx.Value(mw.ContextKey("operator")).(*model.User) + if !ok { + return nil, ex.ErrBugAuthNoUserCtx + } + member := &model.TeamMember{} + if err := r.DB.Select("role").First(member, `"teamID"=? AND "userUid"=?`, obj.ID, operator.UID).Error; err != nil { + return nil, err + } + return &member.Role, nil +} + +func (r *teamResolver) OwnersCount(ctx context.Context, obj *model.Team) (c int64, err error) { + // panic(fmt.Errorf("not implemented: OwnersCount - ownersCount")) + // var count int64 + err = r.DB.Model(&model.TeamMember{}).Where(`"teamID"=? AND role=?`, obj.ID, model.OWNER).Count(&c).Error + // c = int(count) + return +} + +func (r *teamResolver) EditorsCount(ctx context.Context, obj *model.Team) (c int64, err error) { + // panic(fmt.Errorf("not implemented: EditorsCount - editorsCount")) + // var count int64 + err = r.DB.Model(&model.TeamMember{}).Where(`"teamID"=? AND role=?`, obj.ID, model.EDITOR).Count(&c).Error + // c = int(count) + return +} + +func (r *teamResolver) ViewersCount(ctx context.Context, obj *model.Team) (c int64, err error) { + // panic(fmt.Errorf("not implemented: ViewersCount - viewersCount")) + // var count int64 + err = r.DB.Model(&model.TeamMember{}).Where(`"teamID"=? AND role=?`, obj.ID, model.VIEWER).Count(&c).Error + // c = int(count) + return +} + +func (r *teamResolver) TeamInvitations(ctx context.Context, obj *model.Team) (i []*model.TeamInvitation, err error) { + // panic(fmt.Errorf("not implemented: TeamInvitations - teamInvitations")) + err = GetPreloadedDB(r.DB, ctx).Find(&i, `"teamID"=?`, obj.ID).Error + return +} + +func (r *teamResolver) TeamEnvironments(ctx context.Context, obj *model.Team) (e []*model.TeamEnvironment, err error) { + // panic(fmt.Errorf("not implemented: TeamEnvironments - teamEnvironments")) + err = GetPreloadedDB(r.DB, ctx).Find(&e, `"teamID"=?`, obj.ID).Error + return +} + +func (r *userResolver) GlobalEnvironments(ctx context.Context, obj *model.User) (e *model.UserEnvironment, err error) { + // panic(fmt.Errorf("not implemented: GlobalEnvironments - globalEnvironments")) + err = GetPreloadedDB(r.DB, ctx).First(&e, `"userUid"=? AND isGlobal`, obj.UID).Error + return +} + +func (r *userResolver) RESTHistory(ctx context.Context, obj *model.User, cursor *string, take *int) (h []*model.UserHistory, err error) { + // panic(fmt.Errorf("not implemented: RESTHistory - RESTHistory")) + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Limit(getLimit(take)).Find(&h, `"userUid"=? AND "reqType"=?`, obj.UID, model.REST).Error + return +} + +func (r *userResolver) GQLHistory(ctx context.Context, obj *model.User, cursor *string, take *int) (h []*model.UserHistory, err error) { + // panic(fmt.Errorf("not implemented: GQLHistory - GQLHistory")) + base := GetPreloadedDB(r.DB, ctx) + if cursor != nil { + base = base.Where("id > ?", *cursor) + } + err = base.Find(&h, `"userUid"=? AND "reqType"=?`, obj.UID, model.GQL).Error + return +} + +func (r *userCollectionResolver) ChildrenRest(ctx context.Context, obj *model.UserCollection, cursor *string, take *int) ([]*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: ChildrenRest - childrenREST")) + colls := []*model.UserCollection{} + if err := GetPreloadedDB(r.DB, ctx).Find(&colls, `"parentID"=? AND type=?`, obj.ID, model.REST).Error; err != nil { + return nil, err + } + return colls, nil +} + +func (r *userCollectionResolver) ChildrenGql(ctx context.Context, obj *model.UserCollection, cursor *string, take *int) ([]*model.UserCollection, error) { + // panic(fmt.Errorf("not implemented: ChildrenGql - childrenGQL")) + colls := []*model.UserCollection{} + if err := GetPreloadedDB(r.DB, ctx).Find(&colls, `"parentID"=? AND type=?`, obj.ID, model.GQL).Error; err != nil { + return nil, err + } + return colls, nil +} + +func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } + +func (r *Resolver) Query() QueryResolver { return &queryResolver{r} } + +func (r *Resolver) Subscription() SubscriptionResolver { return &subscriptionResolver{r} } + +func (r *Resolver) Team() TeamResolver { return &teamResolver{r} } + +func (r *Resolver) User() UserResolver { return &userResolver{r} } + +func (r *Resolver) UserCollection() UserCollectionResolver { return &userCollectionResolver{r} } + +type mutationResolver struct{ *Resolver } +type queryResolver struct{ *Resolver } +type subscriptionResolver struct{ *Resolver } +type teamResolver struct{ *Resolver } +type userResolver struct{ *Resolver } +type userCollectionResolver struct{ *Resolver } diff --git a/internal/graph/services.go b/internal/graph/services.go new file mode 100644 index 0000000..cc0c18a --- /dev/null +++ b/internal/graph/services.go @@ -0,0 +1,260 @@ +package graph + +import ( + "dto" + "fmt" + "model" + + "github.com/lucsky/cuid" + "gorm.io/gorm" + "gorm.io/gorm/clause" +) + +func createTeam(db *gorm.DB, name, creator string) (*model.Team, error) { + teamID := cuid.New() + user := model.User{} + err := db.First(&user, "uid=?", creator).Error + if err != nil { + return nil, err + } + team := &model.Team{ID: teamID, Name: name, Members: []model.TeamMember{ + {ID: cuid.New(), TeamID: teamID, UserUID: creator, Role: model.OWNER, User: user}, + }} + err = db.Create(team).Error + return team, err +} + +func removeTeamMember(db *gorm.DB, teamID, userUID string) (string, error) { + var member []model.TeamMember + result := db.Clauses( + clause.Returning{Columns: []clause.Column{{Name: "id"}}}, + ).Delete( + &member, + `"teamID" = ? AND "userUid" = ?`, teamID, userUID, + ) + if result.Error != nil { + return "", result.Error + } + return member[0].ID, nil +} + +func getUserMaxOrderIndex(db *gorm.DB, model model.Orderable, userUID string, parentID *string) int32 { + result := &struct { + latest int32 + }{0} + base := db.Model(model).Select(`MAX("orderIndex") as latest`).Where(`"UserUid"=?`, userUID) + if parentID != nil { + base.Where(fmt.Sprintf(`"%s" = ?`, model.ParentColName()), *parentID).Find(result) + } else { + base.Where(fmt.Sprintf(`"%s" IS NULL`, model.ParentColName())).Find(result) + } + return result.latest +} + +func getTeamMaxOrderIndex(db *gorm.DB, model model.Orderable, teamID *string, parentID *string) int32 { + result := &struct { + latest int32 + }{0} + base := db.Model(model).Select(`MAX("orderIndex") as latest`) + if teamID != nil { + base = base.Where(`"teamID"=?`, teamID) + } + if parentID != nil { + base.Where(fmt.Sprintf(`"%s" = ?`, model.ParentColName()), *parentID).Find(result) + } else { + base.Where(fmt.Sprintf(`"%s" IS NULL`, model.ParentColName())).Find(result) + } + return result.latest +} + +func moveTeamOrderIndex(db *gorm.DB, model model.Orderable, teamID string, parentID *string, upper, lower *int32, up bool) error { + expr := gorm.Expr(`"orderIndex" + 1`) + if up { + expr = gorm.Expr(`"orderIndex" - 1`) + } + base := db.Model(model).Where(fmt.Sprintf(`"teamID"=? AND "%s"=?`, model.ParentColName()), teamID, parentID) + if upper != nil { + base = base.Where(`"orderIndex">?`, *upper) + } + if lower != nil { + base = base.Where(`"orderIndex"?`, *upper) + } + if lower != nil { + base = base.Where(`"orderIndex"?`, req.OrderIndex).Update(`"orderIndex"`, gorm.Expr(`"orderIndex" - 1`)).Error; err != nil { + tx.Rollback() + return nil, err + } + if err := tx.Model(req).Where(`"collectionID"=?`, destinationCollectionID).Where(`"orderIndex">=?`, nextReq.OrderIndex).Update(`"orderIndex"`, gorm.Expr(`"orderIndex" + 1`)).Error; err != nil { + tx.Rollback() + return nil, err + } + req.CollectionID = destinationCollectionID + req.OrderIndex = nextReq.OrderIndex + if err := tx.Save(req).Error; err != nil { + tx.Rollback() + return nil, err + } + tx.Commit() + if err := db.Where(`"userUid" = ?`, uid).First(req, "id=?", requestID).Error; err != nil { + return nil, err + } + if err := db.Where(`"userUid" = ?`, uid).First(nextReq, "id=?", nextRequestID).Error; err != nil { + return nil, err + } + return &dto.UserRequestReorderData{ + Request: req, + NextRequest: nextReq, + }, nil +} + +func updateTeamCollectionOrder(db *gorm.DB, coll *model.TeamCollection, destColl *model.TeamCollection) (*dto.CollectionReorderData, error) { + tx := db.Begin() + if coll.OrderIndex < destColl.OrderIndex { + if err := moveTeamOrderIndex(db, destColl, coll.TeamID, coll.ParentID, &coll.OrderIndex, &destColl.OrderIndex, true); err != nil { + tx.Rollback() + return nil, err + } + coll.OrderIndex = destColl.OrderIndex - 1 + if err := tx.Save(coll).Error; err != nil { + tx.Rollback() + return nil, err + } + } else { + upper := destColl.OrderIndex - 1 + if err := moveTeamOrderIndex(db, destColl, coll.TeamID, coll.ParentID, &upper, &coll.OrderIndex, false); err != nil { + tx.Rollback() + return nil, err + } + coll.OrderIndex = upper + if err := tx.Save(coll).Error; err != nil { + tx.Rollback() + return nil, err + } + } + tx.Commit() + return &dto.CollectionReorderData{ + Collection: coll, + NextCollection: destColl, + }, nil +} + +func updateTeamRequestOrder(db *gorm.DB, req *model.TeamRequest, destReq *model.TeamRequest) (*dto.RequestReorderData, error) { + tx := db.Begin() + if req.OrderIndex < destReq.OrderIndex { + if err := moveTeamOrderIndex(db, destReq, req.TeamID, &req.CollectionID, &req.OrderIndex, &destReq.OrderIndex, true); err != nil { + tx.Rollback() + return nil, err + } + req.OrderIndex = destReq.OrderIndex - 1 + if err := tx.Save(req).Error; err != nil { + tx.Rollback() + return nil, err + } + } else { + upper := destReq.OrderIndex - 1 + if err := moveTeamOrderIndex(db, destReq, req.TeamID, &req.CollectionID, &upper, &req.OrderIndex, false); err != nil { + tx.Rollback() + return nil, err + } + req.OrderIndex = upper + if err := tx.Save(req).Error; err != nil { + tx.Rollback() + return nil, err + } + } + tx.Commit() + return &dto.RequestReorderData{ + Request: req, + NextRequest: destReq, + }, nil +} diff --git a/internal/graph/type.go b/internal/graph/type.go new file mode 100644 index 0000000..d97e435 --- /dev/null +++ b/internal/graph/type.go @@ -0,0 +1,32 @@ +package graph + +import ( + "fmt" + "io" + "time" + + "github.com/99designs/gqlgen/graphql" +) + +// MarshalDateTimeScalar convert a time.Time to DateTime Scalar +func MarshalDateTimeScalar(t time.Time) graphql.Marshaler { + return graphql.WriterFunc(func(w io.Writer) { + w.Write([]byte(t.Format(time.RFC3339))) + }) +} + +// UnmarshalDateTimeScalar try to convert a string or a int object to a time.Time +func UnmarshalDateTimeScalar(v interface{}) (time.Time, error) { + switch v := v.(type) { + case string: + return time.Parse(time.RFC3339, v) + case int: + return time.Unix(int64(v), 0), nil + case int32: + return time.Unix(int64(v), 0), nil + case int64: + return time.Unix(int64(v), 0), nil + default: + return time.Time{}, fmt.Errorf("%T is not a time.Time", v) + } +} diff --git a/internal/graph/util.go b/internal/graph/util.go new file mode 100644 index 0000000..f2207bc --- /dev/null +++ b/internal/graph/util.go @@ -0,0 +1,8 @@ +package graph + +func getLimit(take *int) int { + if take != nil { + return *take + } + return 10 +} diff --git a/internal/rest/controller.go b/internal/rest/controller.go new file mode 100644 index 0000000..bec465b --- /dev/null +++ b/internal/rest/controller.go @@ -0,0 +1,365 @@ +package rest + +import ( + "encoding/json" + "fmt" + "net/http" + "os" + "strings" + "time" + + ex "exception" + "mail" + mw "middleware" + "model" + + "github.com/coreos/go-oidc/v3/oidc" + jwt "github.com/golang-jwt/jwt/v5" + "github.com/rs/zerolog/log" + "golang.org/x/oauth2" + "gorm.io/gorm" +) + +func ServeMux(path string) *http.ServeMux { + mux := http.NewServeMux() + mux.HandleFunc(path+"providers", Providers) + mux.HandleFunc(path+"signin", SignInMagicLink) + mux.HandleFunc(path+"verify", Verify) + mux.HandleFunc(path+"refresh", Refersh) + mux.HandleFunc(path+"logout", Logout) + mux.Handle(path+"google", Redirect(GoogleConfig)) + mux.Handle(path+"google/callback", Callback(GoogleConfig, GoogleProvider)) + mux.Handle(path+"github", Redirect(GithubConfig)) + mux.Handle(path+"github/callback", Callback(GithubConfig, GithubProvider)) + mux.Handle(path+"microsoft", Redirect(MicrosoftConfig)) + mux.Handle(path+"microsoft/callback", Callback(MicrosoftConfig, MicrosoftProvider)) + + return mux +} + +// Ping is healthcheck endpoint +func Ping(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte("Success")) +} + +func Providers(w http.ResponseWriter, r *http.Request) { + p := provider{ + strings.Split(os.Getenv("VITE_ALLOWED_AUTH_PROVIDERS"), ","), + } + if len(p.Providers) == 0 { + responder(w, resp{ + ex.ErrEnvEmptyAuthProviders.Error(), + ex.ErrEnvEmptyAuthProviders.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + responder(w, p, http.StatusOK) +} + +// Route to initiate magic-link auth for a users email +func SignInMagicLink(w http.ResponseWriter, r *http.Request) { + db := getDB(w, r) + if db == nil { + return + } + authData := signInMagicDto{} + if err := json.NewDecoder(r.Body).Decode(&authData); err != nil { + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusBadRequest, + }, http.StatusBadRequest) + return + } + user := &model.User{} + token := &model.VerificationToken{} + tx := db.Begin() + + if err := tx.First(user, "email=?", authData.Email).Error; err == nil { + if _, err := generateMagicLinkTokens(user, tx); err != nil { + tx.Rollback() + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + } else if err == gorm.ErrRecordNotFound { + if user, err = createUserViaMagicLink(authData.Email, tx); err != nil { + tx.Rollback() + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + if token, err = generateMagicLinkTokens(user, tx); err != nil { + tx.Rollback() + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + } else { + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + var url string + query := r.URL.Query() + origin := query.Get("origin") + switch origin { + case "admin": + url = os.Getenv("VITE_ADMIN_URL") + case "app": + url = os.Getenv("VITE_BASE_URL") + default: + // if origin is invalid by default set URL to Hoppscotch-App + url = os.Getenv("VITE_BASE_URL") + } + magicLink := fmt.Sprintf("%s/enter?token=%s", url, token.Token) + if err := mail.SendUserInvitation(*user.Email, magicLink); err != nil { + tx.Rollback() + responder(w, resp{ + err.Error(), + err.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + tx.Commit() + w.WriteHeader(http.StatusOK) + w.Write([]byte(fmt.Sprintf("{\"deviceIdentifier\":\"%s\"}", token.DeviceIdentifier))) +} + +// Route to verify and sign in a valid user via magic-link +func Verify(w http.ResponseWriter, r *http.Request) { + db := getDB(w, r) + if db == nil { + return + } + authData := verifyMagicDto{} + err := json.NewDecoder(r.Body).Decode(&authData) + if err != nil { + responder(w, resp{ + err.Error(), + ex.ErrJSONInvalid.Error(), + http.StatusBadRequest, + }, http.StatusBadRequest) + return + } + authTokens, err := verifyMagicLinkTokens(&authData, db) + if err != nil { + switch err { + case ex.ErrInvalidMagicLinkData: + responder(w, resp{ + err.Error(), + err.Error(), + http.StatusNotFound, + }, http.StatusNotFound) + default: + responder(w, resp{ + err.Error(), + err.Error(), + http.StatusBadRequest, + }, http.StatusBadRequest) + + } + return + } + log.Info().Msgf("ccess_token: %s \n refresh_token: %s", authTokens.Access_token, authTokens.Refresh_token) + authCookieHandler(w, r, authTokens) + w.WriteHeader(http.StatusOK) +} + +/* +Route to refresh auth tokens with Refresh Token Rotation + +@see https://auth0.com/docs/secure/tokens/refresh-tokens/refresh-token-rotation +*/ +func Refersh(w http.ResponseWriter, r *http.Request) { + rt, err := r.Cookie("refresh_token") + if err != nil || rt == nil { + responder(w, resp{ + ex.ErrCookiesNotFound.Error(), + ex.ErrCookiesNotFound.Error(), + http.StatusNotFound, + }, http.StatusNotFound) + return + } + rToken, err := jwt.Parse(rt.Value, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + return []byte(secret), nil + }) + if err != nil { + responder(w, resp{ + ex.ErrInvalidRefreshToken.Error(), + ex.ErrInvalidRefreshToken.Error(), + http.StatusBadRequest, + }, http.StatusBadRequest) + return + } + if claims, ok := rToken.Claims.(jwt.MapClaims); ok { + uid, err := claims.GetSubject() + if err != nil { + responder(w, resp{ + ex.ErrInvalidRefreshToken.Error(), + ex.ErrInvalidRefreshToken.Error(), + http.StatusBadRequest, + }, http.StatusBadRequest) + return + } + tk, err := mw.NewToken(uid, false) + if err != nil { + responder(w, resp{ + err.Error(), + ex.ErrInvalidRefreshToken.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return + } + http.SetCookie(w, &http.Cookie{ + Name: "refresh_token", + Value: tk, + Expires: time.Now().Add(refreshExpires), + SameSite: http.SameSiteLaxMode, + }) + w.WriteHeader(http.StatusOK) + } + +} + +// Log user out by clearing cookies containing auth tokens +func Logout(w http.ResponseWriter, r *http.Request) { + http.SetCookie(w, &http.Cookie{ + Name: "access_token", + Value: "", + }) + http.SetCookie(w, &http.Cookie{ + Name: "refresh_token", + Value: "", + }) + w.WriteHeader(http.StatusOK) +} + +func Redirect(config *oauth2.Config) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + + state, err := randString(16) + if err != nil { + http.Error(w, "Internal error", http.StatusInternalServerError) + return + } + c := &http.Cookie{ + Name: "state", + Value: state, + MaxAge: int(time.Hour.Seconds()), + Secure: r.TLS != nil, + HttpOnly: true, + } + http.SetCookie(w, c) + http.Redirect(w, r, config.AuthCodeURL(state), http.StatusFound) + }) +} + +func Callback(config *oauth2.Config, provider *oidc.Provider) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + db := getDB(w, r) + if db == nil { + return + } + state, err := r.Cookie("state") + if err != nil { + http.Error(w, "state not found", http.StatusBadRequest) + return + } + if r.URL.Query().Get("state") != state.Value { + http.Error(w, "state did not match", http.StatusBadRequest) + return + } + + oauth2Token, err := config.Exchange(r.Context(), r.URL.Query().Get("code")) + if err != nil { + http.Error(w, "Failed to exchange token: "+err.Error(), http.StatusInternalServerError) + return + } + + userInfo, err := provider.UserInfo(r.Context(), oauth2.StaticTokenSource(oauth2Token)) + if err != nil { + http.Error(w, "Failed to get userinfo: "+err.Error(), http.StatusInternalServerError) + return + } + var profile profile + if err := json.Unmarshal([]byte(userInfo.Profile), &profile); err != nil { + http.Error(w, "Failed to parse profile: "+err.Error(), http.StatusInternalServerError) + return + } + + user := &model.User{} + err = db.Where("email =?", userInfo.Email).First(user).Error + if err != nil { + if err != gorm.ErrRecordNotFound { + http.Error(w, "Failed to get user: "+err.Error(), http.StatusInternalServerError) + return + } + user, err = createSSOUser(db, profile) + if err != gorm.ErrRecordNotFound { + http.Error(w, "Failed to create user: "+err.Error(), http.StatusInternalServerError) + return + } + } + if user.DisplayName == nil { + user.DisplayName = &userInfo.Email + err = db.Save(user).Error + if err != nil { + http.Error(w, "Failed to save user: "+err.Error(), http.StatusInternalServerError) + return + } + } + + at, err := mw.NewToken(user.UID, true) + if err != nil { + http.Error(w, "Failed to generate access token: "+err.Error(), http.StatusInternalServerError) + return + } + rt, err := mw.NewToken(user.UID, false) + if err != nil { + http.Error(w, "Failed to generate refresh token: "+err.Error(), http.StatusInternalServerError) + return + } + user.RefreshToken = &rt + err = db.Save(&user).Error + if err != nil { + http.Error(w, "Failed to set refresh token: "+err.Error(), http.StatusInternalServerError) + return + } + + account := &model.Account{} + err = db.Where("provider=? AND providerAccountId=?", "magic", user.Email).First(account).Error + if err != nil { + if err != gorm.ErrRecordNotFound { + http.Error(w, "Failed to get account: "+err.Error(), http.StatusInternalServerError) + return + } + _, err = createSSOAccount(db, profile, user.UID, at, rt) + if err != nil { + http.Error(w, "Failed to create account: "+err.Error(), http.StatusInternalServerError) + return + } + } + + authCookieHandler(w, r, &authTokens{at, rt}) + http.Redirect(w, r, config.RedirectURL, http.StatusOK) + }) +} diff --git a/internal/rest/go.mod b/internal/rest/go.mod new file mode 100644 index 0000000..78cf9a3 --- /dev/null +++ b/internal/rest/go.mod @@ -0,0 +1,18 @@ +module rest + +go 1.21.5 + +require ( + github.com/coreos/go-oidc/v3 v3.9.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1 // indirect + github.com/golang-jwt/jwt/v5 v5.2.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/lucsky/cuid v1.2.1 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/oauth2 v0.15.0 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gorm.io/gorm v1.25.5 // indirect +) diff --git a/internal/rest/go.sum b/internal/rest/go.sum new file mode 100644 index 0000000..7003520 --- /dev/null +++ b/internal/rest/go.sum @@ -0,0 +1,68 @@ +github.com/coreos/go-oidc/v3 v3.9.0 h1:0J/ogVOd4y8P0f0xUh8l9t07xRP/d8tccvjHl2dcsSo= +github.com/coreos/go-oidc/v3 v3.9.0/go.mod h1:rTKz2PYwftcrtoCzV5g5kvfJoWcm0Mk8AF8y1iAQro4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= +github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/lucsky/cuid v1.2.1 h1:MtJrL2OFhvYufUIn48d35QGXyeTC8tn0upumW9WwTHg= +github.com/lucsky/cuid v1.2.1/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= +golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= +golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/internal/rest/init.go b/internal/rest/init.go new file mode 100644 index 0000000..def8e3b --- /dev/null +++ b/internal/rest/init.go @@ -0,0 +1,105 @@ +package rest + +import ( + "context" + "fmt" + "os" + "strconv" + "strings" + "time" + + "github.com/coreos/go-oidc/v3/oidc" + "golang.org/x/oauth2" +) + +const defaultSecret = "secret123" +const defaultAccessExpires = 24 * time.Hour +const defaultRefreshExpires = 7 * 24 * time.Hour + +const GoogleURL = "https://accounts.google.com" +const GithubURL = "https://github.com" +const MicrosoftURL = "https://login.microsoftonline.com/%s" + +var secret string +var accessExpires time.Duration +var refreshExpires time.Duration +var GoogleProvider *oidc.Provider +var GithubProvider *oidc.Provider +var MicrosoftProvider *oidc.Provider +var GoogleConfig *oauth2.Config +var GithubConfig *oauth2.Config +var MicrosoftConfig *oauth2.Config + +func init() { + secret = os.Getenv("JWT_SECRET") + if secret == "" { + secret = defaultSecret + } + sec, err := strconv.ParseInt(os.Getenv("ACCESS_TOKEN_VALIDITY"), 10, 0) + if err != nil { + accessExpires = defaultAccessExpires + } else { + accessExpires = time.Duration(sec) * time.Millisecond + } + sec, err = strconv.ParseInt(os.Getenv("REFRESH_TOKEN_VALIDITY"), 10, 0) + if err != nil { + refreshExpires = defaultRefreshExpires + } else { + refreshExpires = time.Duration(sec) * time.Millisecond + } + google_client_id := os.Getenv("GOOGLE_CLIENT_ID") + google_client_secret := os.Getenv("GOOGLE_CLIENT_SECRET") + google_callback_url := os.Getenv("GOOGLE_CALLBACK_URL") + google_scope := os.Getenv("GOOGLE_SCOPE") + if google_client_id != "" && google_client_secret != "" && google_callback_url != "" && google_scope != "" { + GoogleProvider, err = oidc.NewProvider(context.Background(), GoogleURL) + if err == nil { + scope := strings.Split(google_scope, ",") + scope = append(scope, oidc.ScopeOpenID) + GoogleConfig = &oauth2.Config{ + ClientID: google_client_id, + ClientSecret: google_client_secret, + Endpoint: GoogleProvider.Endpoint(), + RedirectURL: google_callback_url, + Scopes: scope, + } + } + } + github_client_id := os.Getenv("GITHUB_CLIENT_ID") + github_client_secret := os.Getenv("GITHUB_CLIENT_SECRET") + github_callback_url := os.Getenv("GITHUB_CALLBACK_URL") + github_scope := os.Getenv("GITHUB_SCOPE") + if github_client_id != "" && github_client_secret != "" && github_callback_url != "" && github_scope != "" { + GithubProvider, err := oidc.NewProvider(context.Background(), GithubURL) + if err == nil { + scope := strings.Split(github_scope, ",") + scope = append(scope, oidc.ScopeOpenID) + GithubConfig = &oauth2.Config{ + ClientID: github_client_id, + ClientSecret: github_client_secret, + Endpoint: GithubProvider.Endpoint(), + RedirectURL: github_callback_url, + Scopes: scope, + } + } + } + microsoft_client_id := os.Getenv("MICROSOFT_CLIENT_ID") + microsoft_client_secret := os.Getenv("MICROSOFT_CLIENT_SECRET") + microsoft_callback_url := os.Getenv("MICROSOFT_CALLBACK_URL") + microsoft_scope := os.Getenv("MICROSOFT_SCOPE") + microsoft_tenant := os.Getenv("MICROSOFT_TENANT") + if microsoft_client_id != "" && microsoft_client_secret != "" && microsoft_callback_url != "" && microsoft_scope != "" { + MicrosoftProvider, err := oidc.NewProvider(context.Background(), fmt.Sprintf(MicrosoftURL, microsoft_tenant)) + if err == nil { + scope := strings.Split(microsoft_scope, ",") + scope = append(scope, oidc.ScopeOpenID) + MicrosoftConfig = &oauth2.Config{ + ClientID: microsoft_client_id, + ClientSecret: microsoft_client_secret, + Endpoint: MicrosoftProvider.Endpoint(), + RedirectURL: microsoft_callback_url, + Scopes: scope, + } + } + } +} diff --git a/internal/rest/service.go b/internal/rest/service.go new file mode 100644 index 0000000..9b5b564 --- /dev/null +++ b/internal/rest/service.go @@ -0,0 +1,169 @@ +package rest + +import ( + "crypto/rand" + "encoding/base64" + "io" + "net/http" + "os" + "strconv" + "time" + + ex "exception" + mw "middleware" + "model" + + "github.com/lucsky/cuid" + "golang.org/x/crypto/bcrypt" + "gorm.io/gorm" +) + +func generateMagicLinkTokens(user *model.User, db *gorm.DB) (*model.VerificationToken, error) { + saltComplexityStr := os.Getenv("TOKEN_SALT_COMPLEXITY") + tokenValidityHoursStr := os.Getenv("MAGIC_LINK_TOKEN_VALIDITY") + tokenValidityHours, err := strconv.Atoi(tokenValidityHoursStr) + if err != nil { + // Handle the error + return nil, err + } + // Generate a salt using bcrypt + salt, err := bcrypt.GenerateFromPassword([]byte(saltComplexityStr), bcrypt.DefaultCost) + if err != nil { + // Handle the error + return nil, err + } + + // Calculate the expiration time + expiresOn := time.Now().Add(time.Hour * time.Duration(tokenValidityHours)) + + idToken := &model.VerificationToken{ + DeviceIdentifier: string(salt), + Token: cuid.New(), + UserUID: user.UID, + ExpiresOn: expiresOn, + } + err = db.Create(idToken).Error + return idToken, err +} + +func createUserViaMagicLink(email string, db *gorm.DB) (*model.User, error) { + user := &model.User{ + UID: cuid.New(), + DisplayName: &email, + Email: &email, + } + err := db.Create(user).Error + return user, err +} + +func createMagicAccount(db *gorm.DB, user *model.User) (*model.Account, error) { + account := &model.Account{ + ID: cuid.New(), + UserID: user.UID, + Provider: "magic", + ProviderAccountID: *user.Email, + } + err := db.Create(account).Error + return account, err +} + +func verifyMagicLinkTokens(dto *verifyMagicDto, db *gorm.DB) (*authTokens, error) { + tk := &model.VerificationToken{} + err := db.Preload("User").Where("\"deviceIdentifier\"=?", dto.DeviceIdentifier).Where("token=?", dto.Token).First(tk).Error + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + // switch err { + // case gorm.ErrRecordNotFound: + // return nil, ex.ErrInvalidMagicLinkData + // default: + // return nil, err + // } + } + if tk.ExpiresOn.Before(time.Now()) { + return nil, ex.ErrTokenExpired + } + user := tk.User + account := &model.Account{} + err = db.Where("provider=? AND \"providerAccountId\"=?", "magic", user.Email).First(account).Error + if err != nil { + if err != gorm.ErrRecordNotFound { + return nil, ex.ErrInvalidMagicLinkData + } + _, err = createMagicAccount(db, &user) + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + } + } + + at, err := mw.NewToken(user.UID, true) + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + } + rt, err := mw.NewToken(user.UID, false) + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + } + user.RefreshToken = &rt + err = db.Save(&user).Error + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + } + // delete token + err = db.Delete(tk, "\"deviceIdentifier\"=? AND token=?", tk.DeviceIdentifier, tk.Token).Error + if err != nil { + return nil, ex.ErrInvalidMagicLinkData + } + return &authTokens{at, rt}, nil +} + +func authCookieHandler(w http.ResponseWriter, r *http.Request, token *authTokens) { + now := time.Now() + aexp := now.Add(time.Duration(accessExpires)) + rexp := now.Add(time.Duration(refreshExpires)) + http.SetCookie(w, &http.Cookie{ + Name: "access_token", + Value: token.Access_token, + Expires: aexp, + SameSite: http.SameSiteLaxMode, + Path: "/", + }) + http.SetCookie(w, &http.Cookie{ + Name: "refresh_token", + Value: token.Refresh_token, + Expires: rexp, + SameSite: http.SameSiteLaxMode, + Path: "/", + }) +} + +func createSSOUser(db *gorm.DB, profile profile) (*model.User, error) { + user := &model.User{ + UID: cuid.New(), + Email: &profile.Email[0], + DisplayName: &profile.DisplayName[0], + PhotoURL: &profile.Photos[0], + } + err := db.Create(user).Error + return user, err +} + +func createSSOAccount(db *gorm.DB, profile profile, uid, access, refresh string) (*model.Account, error) { + account := &model.Account{ + ID: cuid.New(), + Provider: profile.Provider, + ProviderAccountID: profile.ID, + ProviderAccessToken: &access, + ProviderRefreshToken: &refresh, + UserID: uid, + } + err := db.Create(account).Error + return account, err +} + +func randString(nByte int) (string, error) { + b := make([]byte, nByte) + if _, err := io.ReadFull(rand.Reader, b); err != nil { + return "", err + } + return base64.RawURLEncoding.EncodeToString(b), nil +} diff --git a/internal/rest/type.go b/internal/rest/type.go new file mode 100644 index 0000000..cb9c503 --- /dev/null +++ b/internal/rest/type.go @@ -0,0 +1,33 @@ +package rest + +type signInMagicDto struct { + Email string `json:"email"` +} + +type verifyMagicDto struct { + DeviceIdentifier string `json:"deviceIdentifier"` + Token string `json:"token"` +} + +type authTokens struct { + Access_token string + Refresh_token string +} + +type provider struct { + Providers []string `json:"providers"` +} + +type profile struct { + ID string `json:"id"` + Provider string `json:"provider"` + Email []string `json:"email"` + DisplayName []string `json:"displayName"` + Photos []string `json:"photos"` +} + +type resp struct { + Message string `json:"message"` + Error string `json:"error"` + StatusCode int `json:"statusCode"` +} diff --git a/internal/rest/util.go b/internal/rest/util.go new file mode 100644 index 0000000..138215b --- /dev/null +++ b/internal/rest/util.go @@ -0,0 +1,35 @@ +package rest + +import ( + "encoding/json" + ex "exception" + "fmt" + "net/http" + + "gorm.io/gorm" +) + +func responder(w http.ResponseWriter, r any, status int) { + if res, err := json.Marshal(r); err != nil { + http.Error(w, fmt.Sprintf(`{"message":"%s","error":"%s","statusCode":%d}`, err, ex.ErrJSONInvalid, http.StatusInternalServerError), http.StatusInternalServerError) + return + } else { + w.Write(res) + w.WriteHeader(status) + return + } +} + +func getDB(w http.ResponseWriter, r *http.Request) *gorm.DB { + ctx := r.Context() + db, ok := ctx.Value("DB").(*gorm.DB) + if !ok { + responder(w, resp{ + "database not exist", + ex.ErrEnvEmptyAuthProviders.Error(), + http.StatusInternalServerError, + }, http.StatusInternalServerError) + return nil + } + return db +} diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..cb8cbf0 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,72 @@ +# user nobody; +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + # add_header 'Access-Control-Allow-Origin' $http_origin; + # add_header 'Access-Control-Allow-Credentials' true; + # add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Requested-With'; + # add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE'; + + server { + listen 3000; + server_name _; + root /site/selfhost-web/; + index index.html; + try_files $uri $uri/ index.html; + } + server { + listen 3100; + server_name _; + root /site/sh-admin-subpath-access/; + index index.html; + try_files $uri $uri/ index.html; + } + + server { + absolute_redirect off; + client_max_body_size 250M; + listen 3170; + server_name _; + location / { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' $http_origin; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; + add_header Access-Control-Allow-Credentials true; + # + # Custom headers and headers various browsers *should* be OK with but aren't + # + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; + # + # Tell client that this pre-flight info is valid for 20 days + # + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain; charset=utf-8'; + add_header 'Content-Length' 0; + return 204; + } + if ($request_method = 'POST') { + add_header 'Access-Control-Allow-Origin' $http_origin always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header Access-Control-Allow-Credentials true always; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; + } + if ($request_method = 'GET') { + add_header 'Access-Control-Allow-Origin' $http_origin always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header Access-Control-Allow-Credentials true always; + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; + } + proxy_pass http://localhost:8080; + } + } +} \ No newline at end of file diff --git a/pkg/exception/error.go b/pkg/exception/error.go new file mode 100644 index 0000000..b0e252c --- /dev/null +++ b/pkg/exception/error.go @@ -0,0 +1,108 @@ +package exception + +import "errors" + +var ( + ErrInvalidEmail = errors.New("invalid/email") + ErrEmailFailed = errors.New("email/failed") + ErrDuplicateEmail = errors.New("email/both_emails_cannot_be_same") + ErrOnlyOneAdminAccount = errors.New("admin/only_one_admin_account_found") + ErrAuthFail = errors.New("auth/fail") + ErrJSONInvalid = errors.New("json_invalid") + ErrAuthProviderNotSpecified = errors.New("auth/provider_not_specified") + ErrEnvNotFoundKeyAuthProviders = errors.New("\"VITE_ALLOWED_AUTH_PROVIDERS\" is not present in .env file") + ErrEnvEmptyAuthProviders = errors.New("\"VITE_ALLOWED_AUTH_PROVIDERS\" is empty in .env file") + ErrEnvNotSupportAuthProviders = errors.New("\"VITE_ALLOWED_AUTH_PROVIDERS\" contains an unsupported auth provider in .env file") + ErrUserFBDocumentDeletionFailed = errors.New("fb/firebase_document_deletion_failed") + ErrUserNotFound = errors.New("user/not_found") + ErrUserAlreadyInvited = errors.New("admin/user_already_invited") + ErrUserUpdateFailed = errors.New("user/update_failed") + ErrUserDeletionFailed = errors.New("user/deletion_failed") + ErrUsersNotFound = errors.New("user/users_not_found") + ErrUserIsOwner = errors.New("user/is_owner") + ErrUserIsAdmin = errors.New("user/is_admin") + ErrTeamsNotFound = errors.New("user/teams_not_found") + ErrUserCollectionNotFound = errors.New("user_collection/not_found") + ErrUserRequestCreationFailed = errors.New("user_request/creation_failed") + ErrUserRequestInvalidType = errors.New("user_request/type_mismatch") + ErrUserRequestNotFound = errors.New("user_request/not_found") + ErrUserRequestReorderingFailed = errors.New("user_request/reordering_failed") + ErrTeamMemberNotFound = errors.New("team/member_not_found") + ErrTeamNotRequiredRole = errors.New("team/not_required_role") + ErrTeamNameInvalid = errors.New("team/name_invalid") + ErrTeamUserNoFBSyncData = errors.New("team/user_no_fb_syncdata") + ErrTeamFBCollPathResolveFail = errors.New("team/fb_coll_path_resolve_fail") + ErrTeamCollNotFound = errors.New("team_coll/collection_not_found") + ErrTeamCollIsParentColl = errors.New("team_coll/collection_is_parent_coll") + ErrTeamCollNotSameTeam = errors.New("team_coll/collections_not_same_team") + ErrTeamCollDestSame = errors.New("team_coll/target_and_destination_collection_are_same") + ErrTeamColAlreadyRoot = errors.New("team_coll/target_collection_is_already_root_collection") + ErrTeamColNotSameParent = errors.New("team_coll/team_collections_have_different_parents") + ErrTeamColSameNextColl = errors.New("team_coll/collection_and_next_collection_are_same") + ErrTeamColReorderingFailed = errors.New("team_coll/reordering_failed") + ErrTeamOnlyOneOwner = errors.New("team/only_one_owner") + ErrTeamInvalidID = errors.New("team/invalid_id") + ErrTeamInvalidCollID = errors.New("team/invalid_coll_id") + ErrTeamInvalidIDOrUser = errors.New("team/invalid_id_or_user") + ErrTeamCollShortTitle = errors.New("team_coll/short_title") + ErrTeamCollInvalidJSON = errors.New("team_coll/invalid_json") + ErrTeamNotOwner = errors.New("team_coll/team_not_owner") + ErrTeamReqNotRequiredRole = errors.New("team_req/not_required_role") + ErrTeamReqNotFound = errors.New("team_req/not_found") + ErrTeamReqInvalidTargetCollID = errors.New("team_req/invalid_target_id") + ErrTeamReqReorderingFailed = errors.New("team_req/reordering_failed") + ErrSenderEmailInvalid = errors.New("mailer/sender_email_invalid") + ErrTeamReqNotMember = errors.New("team_req/not_member") + ErrTeamInviteMemberHasInvite = errors.New("team_invite/member_has_invite") + ErrTeamInviteNoInviteFound = errors.New("team_invite/no_invite_found") + ErrTeamInviteAlreadyMember = errors.New("team_invite/already_member") + ErrTeamInviteEmailDoNotMatch = errors.New("team_invite/email_do_not_match") + ErrTeamInviteNotValidViewer = errors.New("team_invite/not_valid_viewer") + ErrTeamInvitationNotFound = errors.New("team_invite/invitations_not_found") + ErrShortcodeNotFound = errors.New("shortcode/not_found") + ErrShortcodeInvalidJSON = errors.New("shortcode/invalid_json") + ErrShortcodeAlreadyExists = errors.New("shortcode/already_exists") + ErrTeamEnvironmentNotFound = errors.New("team_environment/not_found") + ErrTeamEnvironmentShortName = errors.New("team_environment/short_name") + ErrTeamEnvironmentNotTeamMember = errors.New("team_environment/not_team_member") + ErrUserSettingsNotFound = errors.New("user_settings/not_found") + ErrUserSettingsAlreadyExists = errors.New("user_settings/settings_already_exists") + ErrUserSettingsNullSettings = errors.New("user_settings/null_settings") + ErrUserEnvironmentGlobalEnvDoesNotExists = errors.New("user_environment/global_env_does_not_exists") + ErrUserEnvironmentGlobalEnvExists = errors.New("user_environment/global_env_already_exists") + ErrUserEnvironmentEnvDoesNotExists = errors.New("user_environment/user_env_does_not_exists") + ErrUserEnvironmentGlobalEnvDeletionFailed = errors.New("user_environment/user_env_global_env_deletion_failed") + ErrUserEnvironmentIsNotGlobal = errors.New("user_environment/user_env_is_not_global") + ErrUserEnvironmentUpdateFailed = errors.New("user_environment/user_env_update_failed") + ErrUserEnvironmentInvalidEnvironmentName = errors.New("user_environment/user_env_invalid_env_name") + ErrUserHistoryNotFound = errors.New("user_history/history_not_found") + ErrUserHistoryInvalidReqType = errors.New("user_history/req_type_invalid") + ErrBugAuthNoUserCtx = errors.New("bug/auth/auth_no_user_ctx") + ErrBugTeamNoTeamID = errors.New("bug/team/no_team_id") + ErrBugTeamNoRequireTeamRole = errors.New("bug/team/no_require_team_role") + ErrBugTeamCollNoCollID = errors.New("bug/team_coll/no_coll_id") + ErrBugTeamReqNoReqID = errors.New("bug/team_req/no_req_id") + ErrBugTeamInviteNoInviteID = errors.New("bug/team_invite/no_invite_id") + ErrBugTeamEnvGuardNoRequireRoles = errors.New("bug/team_env/guard_no_require_roles") + ErrBugTeamEnvGuardNoEnvID = errors.New("bug/team_env/guard_no_env_id") + ErrInvalidMagicLinkData = errors.New("auth/magic_link_invalid_data") + ErrVerificationTokenDataNotFound = errors.New("auth/verification_token_data_not_found") + ErrTokenExpired = errors.New("auth/token_expired") + ErrMagicLinkExpired = errors.New("auth/magic_link_expired") + ErrCookiesNotFound = errors.New("auth/cookies_not_found") + ErrInvalidAccessToken = errors.New("auth/invalid_access_token") + ErrInvalidRefreshToken = errors.New("auth/invalid_refresh_token") + ErrUserCollShortTitle = errors.New("user_coll/short_title") + ErrUserCollNotFound = errors.New("user_coll/not_found") + ErrUserCollAlreadyRoot = errors.New("user_coll/target_user_collection_is_already_root_user_collection") + ErrUserCollDestSame = errors.New("user_coll/target_and_destination_user_collection_are_same") + ErrUserCollNotSameUser = errors.New("user_coll/not_same_user") + ErrUserCollNotSameType = errors.New("user_coll/type_mismatch") + ErrUserCollIsParentColl = errors.New("user_coll/user_collection_is_parent_coll") + ErrUserCollReorderingFailed = errors.New("user_coll/reordering_failed") + ErrUserCollSameNextColl = errors.New("user_coll/user_collection_and_next_user_collection_are_same") + ErrUserNotOwner = errors.New("user_coll/user_not_owner") + ErrUserCollInvalidJSON = errors.New("user_coll/invalid_json") + ErrMailerSMTPUrlUndefined = errors.New("mailer/smtp_url_undefined") + ErrMailerFromAddressUndefined = errors.New("mailer/from_address_undefined") +) diff --git a/pkg/exception/go.mod b/pkg/exception/go.mod new file mode 100644 index 0000000..493ae77 --- /dev/null +++ b/pkg/exception/go.mod @@ -0,0 +1,3 @@ +module exception + +go 1.21.5 diff --git a/pkg/mail/go.mod b/pkg/mail/go.mod new file mode 100644 index 0000000..6eac224 --- /dev/null +++ b/pkg/mail/go.mod @@ -0,0 +1,5 @@ +module mail + +go 1.21.5 + +require github.com/rs/zerolog v1.0.0 diff --git a/pkg/mail/go.sum b/pkg/mail/go.sum new file mode 100644 index 0000000..9273a59 --- /dev/null +++ b/pkg/mail/go.sum @@ -0,0 +1,2 @@ +github.com/rs/zerolog v1.0.0 h1:nyPrZaY4d0BlOTLz7F6eBx4GX7IuaszHwTAOnlK+BfQ= +github.com/rs/zerolog v1.0.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= diff --git a/pkg/mail/mail.go b/pkg/mail/mail.go new file mode 100644 index 0000000..f342f0f --- /dev/null +++ b/pkg/mail/mail.go @@ -0,0 +1,211 @@ +package mail + +import ( + "bytes" + "crypto/tls" + "fmt" + "net/smtp" + "net/url" + "os" + "text/template" + + ex "exception" + + "github.com/rs/zerolog/log" +) + +const ( + defaultUserTemplate = "template/user-invitation.html" + defaultTeamTemplate = "template/user-invitation.html" +) + +var ( + UserTemplate string + TeamTemplate string +) + +func init() { + UserTemplate = os.Getenv("MAILER_USER_TEMPLATE") + if UserTemplate == "" { + UserTemplate = defaultUserTemplate + } + TeamTemplate = os.Getenv("MAILER_TEAM_TEMPLATE") + if TeamTemplate == "" { + TeamTemplate = defaultTeamTemplate + } +} + +// SendMailWithTLS will send mail with a tls conn +func SendMailWithTLS(u *url.URL, auth smtp.Auth, port, from, to string, body []byte) error { + // TLS config + tlsconfig := &tls.Config{ + InsecureSkipVerify: true, + ServerName: u.Hostname(), + } + + conn, err := tls.Dial("tcp", u.Hostname()+":"+port, tlsconfig) + if err != nil { + log.Error().Err(err).Msg("fail to dial") + return err + } + c, err := smtp.NewClient(conn, u.Hostname()) + if err != nil { + log.Error().Err(err).Msg("fail to NewClient") + return err + } + + // Auth + if err = c.Auth(auth); err != nil { + log.Error().Err(err).Msg("fail to auth") + return err + } + + // To && From + if err = c.Mail(from); err != nil { + log.Error().Err(err).Msg("fail to set mailer") + return err + } + + if err = c.Rcpt(to); err != nil { + log.Error().Err(err).Msg("fail to set receiver") + return err + } + + // Data + w, err := c.Data() + if err != nil { + log.Error().Err(err).Msg("fail to get writer") + return err + } + + _, err = w.Write(body) + if err != nil { + log.Error().Err(err).Msg("fail to write") + return err + } + + err = w.Close() + if err != nil { + log.Error().Err(err).Msg("fail to close") + return err + } + + err = c.Quit() + if err != nil { + log.Error().Err(err).Msg("fail to quit") + return err + } + return nil +} + +func SendUserInvitation(to string, magicLink string) error { + from := os.Getenv("MAILER_ADDRESS_FROM") + if from == "" { + return ex.ErrMailerFromAddressUndefined + } + dsn := os.Getenv("MAILER_SMTP_URL") + if dsn == "" { + return ex.ErrMailerSMTPUrlUndefined + } + u, err := url.Parse(dsn) + if err != nil { + log.Error().Err(err).Msg("fail to parse MAILER_SMTP_URL") + return ex.ErrMailerSMTPUrlUndefined + } + port := u.Port() + if port == "" { + port = "465" + } + password, _ := u.User.Password() + // Authentication. + auth := smtp.PlainAuth("", u.User.Username(), password, u.Hostname()) + + t, err := template.ParseFiles(UserTemplate) + if err != nil { + log.Error().Err(err).Msg("fail to parse UserTemplate") + return ex.ErrEmailFailed + } + + var body bytes.Buffer + + mimeHeaders := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n" + body.Write([]byte(fmt.Sprintf("Subject: Sign in to hoppscotch \n%s\n\n", mimeHeaders))) + + err = t.Execute(&body, struct { + InviteeEmail string + MagicLink string + }{ + InviteeEmail: to, + MagicLink: magicLink, + }) + if err != nil { + log.Error().Err(err).Msg("fail to format mail") + return ex.ErrEmailFailed + } + + err = SendMailWithTLS(u, auth, port, from, to, body.Bytes()) + if err != nil { + log.Error().Err(err).Msg("fail to send mail") + return ex.ErrSenderEmailInvalid + } + + log.Debug().Msg("Email Sent!") + return nil +} + +func SendTeamInvitation(to, invitee, invite_team_name, action_url string) error { + from := os.Getenv("MAILER_ADDRESS_FROM") + if from == "" { + return ex.ErrMailerFromAddressUndefined + } + dsn := os.Getenv("MAILER_SMTP_URL") + if dsn == "" { + return ex.ErrMailerSMTPUrlUndefined + } + u, err := url.Parse(dsn) + if err != nil { + log.Error().Err(err).Msg("fail to parse MAILER_SMTP_URL") + return ex.ErrMailerSMTPUrlUndefined + } + port := u.Port() + if port == "" { + port = "465" + } + password, _ := u.User.Password() + // Authentication. + auth := smtp.PlainAuth("", u.User.Username(), password, u.Hostname()) + + t, err := template.ParseFiles(TeamTemplate) + if err != nil { + log.Error().Err(err).Msg("fail to parse TeamTemplate") + return ex.ErrEmailFailed + } + + var body bytes.Buffer + + mimeHeaders := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n" + body.Write([]byte(fmt.Sprintf("Subject: %s invited you to join %s in Hoppscotch \n%s\n\n", invitee, invite_team_name, mimeHeaders))) + + err = t.Execute(&body, struct { + Invitee string + Invite_team_name string + Action_url string + }{ + Invitee: invitee, + Invite_team_name: invite_team_name, + Action_url: action_url, + }) + if err != nil { + log.Error().Err(err).Msg("fail to format mail") + return ex.ErrEmailFailed + } + + // Sending email. + err = SendMailWithTLS(u, auth, port, from, to, body.Bytes()) + if err != nil { + log.Error().Err(err).Msg("fail to SendMailWithTLS") + return ex.ErrSenderEmailInvalid + } + log.Debug().Msg("Email Sent!") + return nil +} diff --git a/pkg/middleware/context.go b/pkg/middleware/context.go new file mode 100644 index 0000000..58e4e76 --- /dev/null +++ b/pkg/middleware/context.go @@ -0,0 +1,3 @@ +package middleware + +type ContextKey string diff --git a/pkg/middleware/db.go b/pkg/middleware/db.go new file mode 100644 index 0000000..3e8d97c --- /dev/null +++ b/pkg/middleware/db.go @@ -0,0 +1,39 @@ +package middleware + +import ( + "context" + "net/http" + + "model" + + "gorm.io/gorm" +) + +// DBMiddleware add gorm DB instance to the context +func DBMiddleware(db *gorm.DB, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + next.ServeHTTP(w, r) + }() + ctx := context.WithValue(r.Context(), ContextKey("DB"), db) + r = r.WithContext(ctx) + }) +} + +func OperatorMiddleware(db *gorm.DB, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + next.ServeHTTP(w, r) + }() + sess, ok := r.Context().Value(ContextKey("session")).(Session) + if !ok { + return + } + user := &model.User{} + if db.First(user, "uid=?", sess.Uid).Error != nil { + return + } + ctx := context.WithValue(r.Context(), ContextKey("operator"), user) + r = r.WithContext(ctx) + }) +} diff --git a/pkg/middleware/go.mod b/pkg/middleware/go.mod new file mode 100644 index 0000000..78210c5 --- /dev/null +++ b/pkg/middleware/go.mod @@ -0,0 +1,14 @@ +module middleware + +go 1.21.5 + +require ( + github.com/golang-jwt/jwt/v5 v5.2.0 + github.com/rs/zerolog v1.0.0 + gorm.io/gorm v1.25.5 +) + +require ( + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect +) diff --git a/pkg/middleware/go.sum b/pkg/middleware/go.sum new file mode 100644 index 0000000..afa217f --- /dev/null +++ b/pkg/middleware/go.sum @@ -0,0 +1,10 @@ +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/rs/zerolog v1.0.0 h1:nyPrZaY4d0BlOTLz7F6eBx4GX7IuaszHwTAOnlK+BfQ= +github.com/rs/zerolog v1.0.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/pkg/middleware/jwt.go b/pkg/middleware/jwt.go new file mode 100644 index 0000000..ae20f4e --- /dev/null +++ b/pkg/middleware/jwt.go @@ -0,0 +1,173 @@ +package middleware + +import ( + "context" + "exception" + "fmt" + "net/http" + "os" + "strconv" + "time" + + jwt "github.com/golang-jwt/jwt/v5" + "github.com/rs/zerolog/log" +) + +const defaultSecret = "secret123" +const defaultAccessExpires = 24 * time.Hour +const defaultRefreshExpires = 7 * 24 * time.Hour + +var secret string +var baseURL string +var accessExpires time.Duration +var refreshExpires time.Duration + +func init() { + baseURL = os.Getenv("VITE_BASE_URL") + secret = os.Getenv("JWT_SECRET") + if secret == "" { + secret = defaultSecret + } + sec, err := strconv.ParseInt(os.Getenv("ACCESS_TOKEN_VALIDITY"), 10, 0) + if err != nil { + accessExpires = defaultAccessExpires + } else { + accessExpires = time.Duration(sec) * time.Millisecond + } + sec, err = strconv.ParseInt(os.Getenv("REFRESH_TOKEN_VALIDITY"), 10, 0) + if err != nil { + refreshExpires = defaultRefreshExpires + } else { + refreshExpires = time.Duration(sec) * time.Millisecond + } +} + +type Session struct { + Uid string + Sid string +} + +func NewToken(uid string, access bool) (string, error) { + now := time.Now().UnixMilli() + var exp int64 + if access { + exp = accessExpires.Milliseconds() + now + } else { + exp = refreshExpires.Milliseconds() + now + } + return jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "iss": baseURL, + "sub": uid, + "aud": []string{baseURL}, + "iat": now, + "exp": exp, + }).SignedString([]byte(secret)) +} + +// JwtMiddleware decodes the share session cookie and packs the logged user into context +func JwtMiddleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer func() { + next.ServeHTTP(w, r) + }() + at, err := r.Cookie("access_token") + if err != nil || at == nil { + log.Error().Err(err).Msg("access_token not found") + return + } + rt, err := r.Cookie("refresh_token") + if err != nil || rt == nil { + log.Error().Err(err).Msg("refresh_token not found") + return + } + var sidStr string + sid, err := r.Cookie("connect.sid") + if err == nil && sid != nil { + sidStr = sid.Value + } + ctx := r.Context() + if ctx == nil { + ctx = context.Background() + } + + // validate token + access, err := jwt.Parse(at.Value, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + return []byte(secret), nil + }) + if err != nil { + if err == jwt.ErrTokenExpired { + // access token expired, check Refersh token + _, err := jwt.Parse(rt.Value, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + return []byte(secret), nil + }) + if err != nil { + switch err { + case jwt.ErrTokenExpired: + log.Error().Err(err).Msg("refresh token expired") + ctx := context.WithValue(ctx, ContextKey("error"), exception.ErrTokenExpired) + r = r.WithContext(ctx) + return + default: + log.Error().Err(err).Msg("refresh token parse failed") + ctx := context.WithValue(ctx, ContextKey("error"), exception.ErrInvalidRefreshToken) + r = r.WithContext(ctx) + return + } + } + if claims, ok := access.Claims.(jwt.MapClaims); ok { + // all good + uid, err := claims.GetSubject() + if err != nil { + log.Error().Err(err).Msg("get uid failed") + ctx = context.WithValue(ctx, ContextKey("error"), err) + r = r.WithContext(ctx) + return + } + // refresh token is valid, get new access token + token, err := NewToken(uid, true) + if err != nil { + log.Error().Err(err).Msg("refresh generate token failed") + ctx = context.WithValue(ctx, ContextKey("error"), err) + r = r.WithContext(ctx) + return + } + access_cookie := http.Cookie{ + Name: "access_token", + Value: token, + Expires: time.Now().Add(accessExpires), + HttpOnly: true, + Secure: true, + SameSite: http.SameSiteLaxMode, + } + http.SetCookie(w, &access_cookie) + } + } + } + if claims, ok := access.Claims.(jwt.MapClaims); ok { + // all good + uid, err := claims.GetSubject() + if err != nil { + log.Error().Err(err).Msg("get uid failed") + ctx = context.WithValue(ctx, ContextKey("error"), err) + } else { + log.Debug().Msgf("uid: %v", uid) + ctx = context.WithValue(ctx, ContextKey("session"), Session{ + Uid: uid, + Sid: sidStr, + }) + } + r = r.WithContext(ctx) + return + } + // access token parse failed + log.Error().Err(err).Msgf("invaild access token") + ctx = context.WithValue(ctx, ContextKey("error"), exception.ErrInvalidAccessToken) + r = r.WithContext(ctx) + }) +} diff --git a/pkg/middleware/log.go b/pkg/middleware/log.go new file mode 100644 index 0000000..54f722f --- /dev/null +++ b/pkg/middleware/log.go @@ -0,0 +1,19 @@ +package middleware + +import ( + "net/http" + "time" + + "github.com/rs/zerolog/log" +) + +// LogMiddleware log the request +func LogMiddleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + defer func() { + next.ServeHTTP(w, r) + log.Info().Msgf("%s [%s] %s in %v", r.RemoteAddr, r.Method, r.URL.Path, time.Since(start)) + }() + }) +} diff --git a/pkg/model/_prisma_migrations.gen.go b/pkg/model/_prisma_migrations.gen.go new file mode 100644 index 0000000..6eb391e --- /dev/null +++ b/pkg/model/_prisma_migrations.gen.go @@ -0,0 +1,28 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNamePrismaMigration = "_prisma_migrations" + +// PrismaMigration mapped from table <_prisma_migrations> +type PrismaMigration struct { + ID string `gorm:"column:id;type:character varying(36);primaryKey" json:"id"` + Checksum string `gorm:"column:checksum;type:character varying(64);not null" json:"checksum"` + FinishedAt *time.Time `gorm:"column:finished_at;type:timestamp with time zone" json:"finished_at"` + MigrationName string `gorm:"column:migration_name;type:character varying(255);not null" json:"migration_name"` + Logs *string `gorm:"column:logs;type:text" json:"logs"` + RolledBackAt *time.Time `gorm:"column:rolled_back_at;type:timestamp with time zone" json:"rolled_back_at"` + StartedAt time.Time `gorm:"column:started_at;type:timestamp with time zone;not null;default:now()" json:"started_at"` + AppliedStepsCount int32 `gorm:"column:applied_steps_count;type:integer;not null" json:"applied_steps_count"` +} + +// TableName PrismaMigration's table name +func (*PrismaMigration) TableName() string { + return TableNamePrismaMigration +} diff --git a/pkg/model/account.gen.go b/pkg/model/account.gen.go new file mode 100644 index 0000000..1bf208b --- /dev/null +++ b/pkg/model/account.gen.go @@ -0,0 +1,29 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameAccount = "Account" + +// Account mapped from table +type Account struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + UserID string `gorm:"column:userId;type:text;not null" json:"userId"` + Provider string `gorm:"column:provider;type:text;not null;uniqueIndex:Account_provider_providerAccountId_key,priority:1" json:"provider"` + ProviderAccountID string `gorm:"column:providerAccountId;type:text;not null;uniqueIndex:Account_provider_providerAccountId_key,priority:2" json:"providerAccountId"` + ProviderRefreshToken *string `gorm:"column:providerRefreshToken;type:text" json:"providerRefreshToken"` + ProviderAccessToken *string `gorm:"column:providerAccessToken;type:text" json:"providerAccessToken"` + ProviderScope *string `gorm:"column:providerScope;type:text" json:"providerScope"` + LoggedIn time.Time `gorm:"column:loggedIn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"loggedIn"` + User User `gorm:"foreignKey:UserID" json:"user"` +} + +// TableName Account's table name +func (*Account) TableName() string { + return TableNameAccount +} diff --git a/pkg/model/go.mod b/pkg/model/go.mod new file mode 100644 index 0000000..a55905f --- /dev/null +++ b/pkg/model/go.mod @@ -0,0 +1,10 @@ +module model + +go 1.21.5 + +require gorm.io/gorm v1.25.5 + +require ( + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect +) diff --git a/pkg/model/go.sum b/pkg/model/go.sum new file mode 100644 index 0000000..960bb5c --- /dev/null +++ b/pkg/model/go.sum @@ -0,0 +1,6 @@ +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= +gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= diff --git a/pkg/model/infraconfig.gen.go b/pkg/model/infraconfig.gen.go new file mode 100644 index 0000000..720229f --- /dev/null +++ b/pkg/model/infraconfig.gen.go @@ -0,0 +1,26 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameInfraConfig = "InfraConfig" + +// InfraConfig mapped from table +type InfraConfig struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + Name string `gorm:"column:name;type:text;not null;uniqueIndex:InfraConfig_name_key,priority:1" json:"name"` + Value *string `gorm:"column:value;type:text" json:"value"` + Active bool `gorm:"column:active;type:boolean;not null;default:true" json:"active"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` +} + +// TableName InfraConfig's table name +func (*InfraConfig) TableName() string { + return TableNameInfraConfig +} diff --git a/pkg/model/invitedusers.gen.go b/pkg/model/invitedusers.gen.go new file mode 100644 index 0000000..bb5b07a --- /dev/null +++ b/pkg/model/invitedusers.gen.go @@ -0,0 +1,26 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameInvitedUser = "InvitedUsers" + +// InvitedUser mapped from table +type InvitedUser struct { + AdminUID string `gorm:"column:adminUid;type:text;not null" json:"adminUid"` + AdminEmail string `gorm:"column:adminEmail;type:text;not null" json:"adminEmail"` + InviteeEmail string `gorm:"column:inviteeEmail;type:text;not null;uniqueIndex:InvitedUsers_inviteeEmail_key,priority:1" json:"inviteeEmail"` + InvitedOn time.Time `gorm:"column:invitedOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"invitedOn"` + Admin User `gorm:"foreignKey:AdminUID" json:"admin"` +} + +// TableName InvitedUser's table name +func (*InvitedUser) TableName() string { + return TableNameInvitedUser +} + diff --git a/pkg/model/shortcode.gen.go b/pkg/model/shortcode.gen.go new file mode 100644 index 0000000..37e267e --- /dev/null +++ b/pkg/model/shortcode.gen.go @@ -0,0 +1,34 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameShortcode = "Shortcode" + +// Shortcode mapped from table +type Shortcode struct { + ID string `gorm:"column:id;type:text;primaryKey;uniqueIndex:Shortcode_id_creatorUid_key,priority:1;uniqueIndex:Shortcode_id_key,priority:1" json:"id"` + Request string `gorm:"column:request;type:jsonb;not null" json:"request"` + CreatorUID *string `gorm:"column:creatorUid;type:text;uniqueIndex:Shortcode_id_creatorUid_key,priority:2" json:"creatorUid"` + EmbedProperties *string `gorm:"column:embedProperties;type:jsonb" json:"embedProperties"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP;autoUpdateTime" json:"updatedOn"` + Creator *User `gorm:"foreignKey:CreatorUID;references:UID" json:"creator"` +} + +// TableName Shortcode's table name +func (*Shortcode) TableName() string { + return TableNameShortcode +} + +func (s *Shortcode) IsOwner(uid string) bool { + if s.CreatorUID == nil { + return false + } + return *s.CreatorUID == uid +} \ No newline at end of file diff --git a/pkg/model/team.gen.go b/pkg/model/team.gen.go new file mode 100644 index 0000000..6cba8ae --- /dev/null +++ b/pkg/model/team.gen.go @@ -0,0 +1,22 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +package model + +const TableNameTeam = "Team" + +// Team mapped from table +type Team struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + Name string `gorm:"column:name;type:text;not null" json:"name"` + Collections []TeamCollection `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"collection"` + Environments []TeamEnvironment `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"environment"` + Invitations []TeamInvitation `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"invitation"` + Members []TeamMember `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"member"` + Requests []TeamRequest `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"request"` +} + +// TableName Team's table name +func (*Team) TableName() string { + return TableNameTeam +} diff --git a/pkg/model/teamcollection.gen.go b/pkg/model/teamcollection.gen.go new file mode 100644 index 0000000..ea8c169 --- /dev/null +++ b/pkg/model/teamcollection.gen.go @@ -0,0 +1,62 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + "gorm.io/gorm" +) + +const TableNameTeamCollection = "TeamCollection" + +// TeamCollection mapped from table +type TeamCollection struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + ParentID *string `gorm:"column:parentID;type:text" json:"parentID"` + TeamID string `gorm:"column:teamID;type:text;not null" json:"teamID"` + Title string `gorm:"column:title;type:text;not null" json:"title"` + OrderIndex int32 `gorm:"column:orderIndex;type:integer;not null" json:"orderIndex"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` + Data *string `gorm:"column:data;type:jsonb" json:"data"` + Team Team `gorm:"foreignKey:TeamID" json:"team"` + Parent *TeamCollection `gorm:"foreignKey:ParentID" json:"parent"` + Children []TeamCollection `gorm:"foreignKey:ParentID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"children"` + Requests []TeamRequest `gorm:"foreignKey:CollectionID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"request"` +} + +// TableName TeamCollection's table name +func (*TeamCollection) TableName() string { + return TableNameTeamCollection +} + +func (c *TeamCollection) GetTeamID() string { + return c.TeamID +} + +func (c *TeamCollection) Can(db *gorm.DB, uid string, role TeamMemberRole) bool { + member := &TeamMember{} + if db.First(member, `"userUid"=? AND "teamID"=?`, uid, c.TeamID).Error != nil { + switch role { + case VIEWER: + return true + case EDITOR: + return member.Role == OWNER || member.Role == EDITOR + case OWNER: + return member.Role == OWNER + default: + return false + } + } + return false +} + +func (*TeamCollection) ParentColName() string { + return "ParentID" +} + +func (c *TeamCollection) Move(db *gorm.DB, next *string) error { + panic("implement me") +} \ No newline at end of file diff --git a/pkg/model/teamenvironment.gen.go b/pkg/model/teamenvironment.gen.go new file mode 100644 index 0000000..8b67747 --- /dev/null +++ b/pkg/model/teamenvironment.gen.go @@ -0,0 +1,46 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "gorm.io/gorm" +) + +const TableNameTeamEnvironment = "TeamEnvironment" + +// TeamEnvironment mapped from table +type TeamEnvironment struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + TeamID string `gorm:"column:teamID;type:text;not null" json:"teamID"` + Name string `gorm:"column:name;type:text;not null" json:"name"` + Variables string `gorm:"column:variables;type:jsonb;not null" json:"variables"` + Team Team `gorm:"foreignKey:TeamID" json:"team"` +} + +// TableName TeamEnvironment's table name +func (*TeamEnvironment) TableName() string { + return TableNameTeamEnvironment +} + +func (e *TeamEnvironment) GetTeamID() string { + return e.TeamID +} + +func (e *TeamEnvironment) Can(db *gorm.DB, uid string, role TeamMemberRole) bool { + member := &TeamMember{} + if db.First(member, `"userUid"=? AND "teamID"=?`, uid, e.TeamID).Error != nil { + switch role { + case VIEWER: + return true + case EDITOR: + return member.Role == OWNER || member.Role == EDITOR + case OWNER: + return member.Role == OWNER + default: + return false + } + } + return false +} \ No newline at end of file diff --git a/pkg/model/teaminvitation.gen.go b/pkg/model/teaminvitation.gen.go new file mode 100644 index 0000000..67fb10c --- /dev/null +++ b/pkg/model/teaminvitation.gen.go @@ -0,0 +1,53 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "gorm.io/gorm" +) + +const TableNameTeamInvitation = "TeamInvitation" + +// TeamInvitation mapped from table +type TeamInvitation struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + TeamID string `gorm:"column:teamID;type:text;not null;uniqueIndex:TeamInvitation_teamID_inviteeEmail_key,priority:1;index:TeamInvitation_teamID_idx,priority:1" json:"teamID"` + CreatorUID string `gorm:"column:creatorUid;type:text;not null" json:"creatorUid"` + InviteeEmail string `gorm:"column:inviteeEmail;type:text;not null;uniqueIndex:TeamInvitation_teamID_inviteeEmail_key,priority:2" json:"inviteeEmail"` + InviteeRole TeamMemberRole `gorm:"column:inviteeRole;type:team_member_role;not null" json:"inviteeRole"` + Team Team `gorm:"foreignKey:TeamID" json:"team"` + Creator User `gorm:"foreignKey:CreatorUID" json:"creator"` +} + +// TableName TeamInvitation's table name +func (*TeamInvitation) TableName() string { + return TableNameTeamInvitation +} + +func (i *TeamInvitation) GetTeamID() string { + return i.TeamID +} + + +func (i *TeamInvitation) Can(db *gorm.DB, uid string, role TeamMemberRole) bool { + member := &TeamMember{} + if db.First(member, `"userUid"=? AND "teamID"=?`, uid, i.TeamID).Error != nil { + switch role { + case VIEWER: + return true + case EDITOR: + return member.Role == OWNER || member.Role == EDITOR + case OWNER: + return member.Role == OWNER + default: + return false + } + } + return false +} + +func (i *TeamInvitation) IsOwner(uid string) bool { + return i.CreatorUID == uid +} diff --git a/pkg/model/teammember.gen.go b/pkg/model/teammember.gen.go new file mode 100644 index 0000000..cf4fd6c --- /dev/null +++ b/pkg/model/teammember.gen.go @@ -0,0 +1,47 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "gorm.io/gorm" +) + +const TableNameTeamMember = "TeamMember" + +// TeamMember mapped from table +type TeamMember struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + Role TeamMemberRole `gorm:"column:role;type:team_member_role;not null" json:"role"` + UserUID string `gorm:"column:userUid;type:text;not null;uniqueIndex:TeamMember_teamID_userUid_key,priority:1" json:"userUid"` + TeamID string `gorm:"column:teamID;type:text;not null;uniqueIndex:TeamMember_teamID_userUid_key,priority:2" json:"teamID"` + Team Team `gorm:"foreignKey:TeamID" json:"team"` + User User `gorm:"foreignKey:UserUID" json:"user"` +} + +// TableName TeamMember's table name +func (*TeamMember) TableName() string { + return TableNameTeamMember +} + +func (m *TeamMember) GetTeamID() string { + return m.TeamID +} + +func (m *TeamMember) Can(db *gorm.DB, uid string, role TeamMemberRole) bool { + member := &TeamMember{} + if db.First(member, `"userUid"=? AND "teamID"=?`, uid, m.TeamID).Error != nil { + switch role { + case VIEWER: + return true + case EDITOR: + return member.Role == OWNER || member.Role == EDITOR + case OWNER: + return member.Role == OWNER + default: + return false + } + } + return false +} \ No newline at end of file diff --git a/pkg/model/teamrequest.gen.go b/pkg/model/teamrequest.gen.go new file mode 100644 index 0000000..b47e7e7 --- /dev/null +++ b/pkg/model/teamrequest.gen.go @@ -0,0 +1,59 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + "gorm.io/gorm" +) + +const TableNameTeamRequest = "TeamRequest" + +// TeamRequest mapped from table +type TeamRequest struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + CollectionID string `gorm:"column:collectionID;type:text;not null" json:"collectionID"` + TeamID string `gorm:"column:teamID;type:text;not null" json:"teamID"` + Title string `gorm:"column:title;type:text;not null" json:"title"` + Request string `gorm:"column:request;type:jsonb;not null" json:"request"` + OrderIndex int32 `gorm:"column:orderIndex;type:integer;not null" json:"orderIndex"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` + Team Team `gorm:"foreignKey:TeamID" json:"team"` + Collection TeamCollection `gorm:"foreignKey:CollectionID" json:"collection"` +} + +// TableName TeamRequest's table name +func (*TeamRequest) TableName() string { + return TableNameTeamRequest +} + +func (r *TeamRequest) GetTeamID() string { + return r.TeamID +} + +func (r *TeamRequest) Can(db *gorm.DB, uid string, role TeamMemberRole) bool { + member := &TeamMember{} + if db.First(member, `"userUid"=? AND "teamID"=?`, uid, r.TeamID).Error != nil { + switch role { + case VIEWER: + return true + case EDITOR: + return member.Role == OWNER || member.Role == EDITOR + case OWNER: + return member.Role == OWNER + default: + return false + } + } + return false +} +func (*TeamRequest) ParentColName() string { + return "CollectionID" +} + +func (r *TeamRequest) Move(db *gorm.DB, next *string) error { + panic("implement me") +} \ No newline at end of file diff --git a/pkg/model/types.go b/pkg/model/types.go new file mode 100644 index 0000000..428958d --- /dev/null +++ b/pkg/model/types.go @@ -0,0 +1,92 @@ +package model + +import ( + "database/sql/driver" + "errors" + + "gorm.io/gorm" +) + +/* Type of a request +REST: restful request + +GQL: graphql request +*/ +// CREATE TYPE "ReqType" AS ENUM ('REST','GQL'); +type ReqType string + +const ( + REST ReqType = "REST" + GQL ReqType = "GQL" +) + +func (rt *ReqType) Scan(value interface{}) error { + *rt = ReqType(value.(string)) + return nil +} + +func (rt ReqType) Value() (driver.Value, error) { + return string(rt), nil +} + +/* Role of a member in team +OWNER: team owner + +VIEWER: can only view team assest + +EDITOR: can read and write team assest +*/ +// CREATE TYPE "TeamMemberRole" AS ENUM ('OWNER','VIEWER','EDITOR'); +type TeamMemberRole string + +const ( + OWNER TeamMemberRole = "OWNER" + VIEWER TeamMemberRole = "VIEWER" + EDITOR TeamMemberRole = "EDITOR" +) + +func (tmr *TeamMemberRole) Scan(value interface{}) error { + *tmr = TeamMemberRole(value.(string)) + return nil +} + +func (tmr TeamMemberRole) Value() (driver.Value, error) { + return string(tmr), nil +} + +// JSONB Interface for JSONB Field +type JSONB string + +// Value Marshal +func (a JSONB) Value() string { + // return json.Marshal(a) + return string(a) +} + +// Scan Unmarshal +func (a *JSONB) Scan(value interface{}) error { + b, ok := value.([]byte) + if !ok { + return errors.New("type assertion to []byte failed") + } + *a = JSONB(b) + // return json.Unmarshal(b, &a) + return nil +} + +// Ownable table has field which link to user +type Ownable interface { + IsOwner(uid string) bool +} + +// Orderable table has fields indicate its order index and collection it's in +type Orderable interface { + ParentColName() string + Move(*gorm.DB, *string) error +} + +// TeamResource table has field which link to user +type TeamResource interface { + GetTeamID() string + Can(*gorm.DB, string, TeamMemberRole) bool +} diff --git a/pkg/model/user.gen.go b/pkg/model/user.gen.go new file mode 100644 index 0000000..5b70223 --- /dev/null +++ b/pkg/model/user.gen.go @@ -0,0 +1,38 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameUser = "User" + +// User mapped from table +type User struct { + UID string `gorm:"column:uid;type:text;primaryKey" json:"uid"` + DisplayName *string `gorm:"column:displayName;type:text" json:"displayName"` + Email *string `gorm:"column:email;type:text;uniqueIndex:User_email_key,priority:1" json:"email"` + PhotoURL *string `gorm:"column:photoURL;type:text" json:"photoURL"` + IsAdmin bool `gorm:"column:isAdmin;type:boolean;not null" json:"isAdmin"` + RefreshToken *string `gorm:"column:refreshToken;type:text" json:"refreshToken"` + CurrentRESTSession *string `gorm:"column:currentRESTSession;type:jsonb" json:"currentRESTSession"` + CurrentGQLSession *string `gorm:"column:currentGQLSession;type:jsonb" json:"currentGQLSession"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + Accounts []Account `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"account"` + Collections []UserCollection `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"collection"` + Environments []UserEnvironment `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"environment"` + Requests []UserRequest `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"request"` + Histories []UserHistory `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"history"` + Settings *UserSetting `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"setting"` + Invitations []InvitedUser `gorm:"foreignKey:AdminUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"invitation"` + VerificationTokens []VerificationToken `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"verificationToken"` + Members []TeamMember `gorm:"foreignKey:UserUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"member"` +} + +// TableName User's table name +func (*User) TableName() string { + return TableNameUser +} diff --git a/pkg/model/usercollection.gen.go b/pkg/model/usercollection.gen.go new file mode 100644 index 0000000..6fe3097 --- /dev/null +++ b/pkg/model/usercollection.gen.go @@ -0,0 +1,46 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + "gorm.io/gorm" +) + +const TableNameUserCollection = "UserCollection" + +// UserCollection mapped from table +type UserCollection struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + ParentID *string `gorm:"column:parentID;type:text" json:"parentID"` + UserUID string `gorm:"column:userUid;type:text;not null" json:"userUid"` + Title string `gorm:"column:title;type:text;not null" json:"title"` + OrderIndex int32 `gorm:"column:orderIndex;type:integer;not null" json:"orderIndex"` + Type ReqType `gorm:"column:type;type:req_type;not null" json:"type"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` + Data *string `gorm:"column:data;type:jsonb" json:"data"` + Parent *UserCollection `gorm:"foreignKey:ParentID" json:"parent"` + User User `gorm:"foreignKey:UserUID" json:"user"` + Children []UserCollection `gorm:"foreignKey:ParentID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"children"` + Requests []UserRequest `gorm:"foreignKey:CollectionID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"request"` +} + +// TableName UserCollection's table name +func (*UserCollection) TableName() string { + return TableNameUserCollection +} + +func (c *UserCollection) IsOwner(uid string) bool { + return c.UserUID == uid +} + +func (*UserCollection) ParentColName() string { + return "parentID" +} + +func (c *UserCollection) Move(db *gorm.DB, next *string) error { + panic("implement me") +} \ No newline at end of file diff --git a/pkg/model/userenvironment.gen.go b/pkg/model/userenvironment.gen.go new file mode 100644 index 0000000..4ae05fc --- /dev/null +++ b/pkg/model/userenvironment.gen.go @@ -0,0 +1,26 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +const TableNameUserEnvironment = "UserEnvironment" + +// UserEnvironment mapped from table +type UserEnvironment struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + UserUID string `gorm:"column:userUid;type:text;not null" json:"userUid"` + Name *string `gorm:"column:name;type:text" json:"name"` + Variables string `gorm:"column:variables;type:jsonb;not null" json:"variables"` + IsGlobal bool `gorm:"column:isGlobal;type:boolean;not null" json:"isGlobal"` + User User `gorm:"foreignKey:UserUID" json:"user"` +} + +// TableName UserEnvironment's table name +func (*UserEnvironment) TableName() string { + return TableNameUserEnvironment +} + +func (e *UserEnvironment) IsOwner(uid string) bool { + return e.UserUID == uid +} diff --git a/pkg/model/userhistory.gen.go b/pkg/model/userhistory.gen.go new file mode 100644 index 0000000..afbca0d --- /dev/null +++ b/pkg/model/userhistory.gen.go @@ -0,0 +1,32 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameUserHistory = "UserHistory" + +// UserHistory mapped from table +type UserHistory struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + UserUID string `gorm:"column:userUid;type:text;not null" json:"userUid"` + ReqType ReqType `gorm:"column:reqType;type:req_type;not null" json:"reqType"` + Request string `gorm:"column:request;type:jsonb;not null" json:"request"` + ResponseMetadata string `gorm:"column:responseMetadata;type:jsonb;not null" json:"responseMetadata"` + IsStarred bool `gorm:"column:isStarred;type:boolean;not null" json:"isStarred"` + ExecutedOn time.Time `gorm:"column:executedOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"executedOn"` + User User `gorm:"foreignKey:UserUID" json:"user"` +} + +// TableName UserHistory's table name +func (*UserHistory) TableName() string { + return TableNameUserHistory +} + +func (h *UserHistory) IsOwner(uid string) bool { + return h.UserUID == uid +} diff --git a/pkg/model/userrequest.gen.go b/pkg/model/userrequest.gen.go new file mode 100644 index 0000000..2396ead --- /dev/null +++ b/pkg/model/userrequest.gen.go @@ -0,0 +1,44 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" + "gorm.io/gorm" +) + +const TableNameUserRequest = "UserRequest" + +// UserRequest mapped from table +type UserRequest struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + CollectionID string `gorm:"column:collectionID;type:text;not null" json:"collectionID"` + UserUID string `gorm:"column:userUid;type:text;not null" json:"userUid"` + Title string `gorm:"column:title;type:text;not null" json:"title"` + Request string `gorm:"column:request;type:jsonb;not null" json:"request"` + Type ReqType `gorm:"column:type;type:req_type;not null" json:"type"` + OrderIndex int32 `gorm:"column:orderIndex;type:integer;not null" json:"orderIndex"` + CreatedOn time.Time `gorm:"column:createdOn;type:timestamp(3) without time zone;not null;default:CURRENT_TIMESTAMP" json:"createdOn"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` + User User `gorm:"foreignKey:UserUID" json:"user"` + Collection UserCollection `gorm:"foreignKey:CollectionID" json:"collection"` +} + +// TableName UserRequest's table name +func (*UserRequest) TableName() string { + return TableNameUserRequest +} + +func (r *UserRequest) IsOwner(uid string) bool { + return r.UserUID == uid +} + +func (*UserRequest) ParentColName() string { + return "collectionID" +} + +func (r *UserRequest) Move(db *gorm.DB, next *string) error { + panic("implement me") +} \ No newline at end of file diff --git a/pkg/model/usersettings.gen.go b/pkg/model/usersettings.gen.go new file mode 100644 index 0000000..f4924d3 --- /dev/null +++ b/pkg/model/usersettings.gen.go @@ -0,0 +1,29 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameUserSetting = "UserSettings" + +// UserSetting mapped from table +type UserSetting struct { + ID string `gorm:"column:id;type:text;primaryKey" json:"id"` + UserUID string `gorm:"column:userUid;type:text;not null;uniqueIndex:UserSettings_userUid_key,priority:1" json:"userUid"` + Properties string `gorm:"column:properties;type:jsonb;not null" json:"properties"` + UpdatedOn time.Time `gorm:"column:updatedOn;type:timestamp(3) without time zone;not null;autoUpdateTime" json:"updatedOn"` + User User `gorm:"foreignKey:UserUID" json:"user"` +} + +// TableName UserSetting's table name +func (*UserSetting) TableName() string { + return TableNameUserSetting +} + +func (s *UserSetting) IsOwner(uid string) bool { + return s.UserUID == uid +} diff --git a/pkg/model/verificationtoken.gen.go b/pkg/model/verificationtoken.gen.go new file mode 100644 index 0000000..408d742 --- /dev/null +++ b/pkg/model/verificationtoken.gen.go @@ -0,0 +1,25 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package model + +import ( + "time" +) + +const TableNameVerificationToken = "VerificationToken" + +// VerificationToken mapped from table +type VerificationToken struct { + DeviceIdentifier string `gorm:"column:deviceIdentifier;type:text;not null;uniqueIndex:VerificationToken_deviceIdentifier_token_key,priority:1" json:"deviceIdentifier"` + Token string `gorm:"column:token;type:text;not null;uniqueIndex:VerificationToken_token_key,priority:1;uniqueIndex:VerificationToken_deviceIdentifier_token_key,priority:2" json:"token"` + UserUID string `gorm:"column:userUid;type:text;not null" json:"userUid"` + ExpiresOn time.Time `gorm:"column:expiresOn;type:timestamp(3) without time zone;not null" json:"expiresOn"` + User User `gorm:"foreignKey:UserUID" json:"user"` +} + +// TableName VerificationToken's table name +func (*VerificationToken) TableName() string { + return TableNameVerificationToken +} diff --git a/pkg/models/_prisma_migrations.gen.go b/pkg/models/_prisma_migrations.gen.go new file mode 100644 index 0000000..b6242c8 --- /dev/null +++ b/pkg/models/_prisma_migrations.gen.go @@ -0,0 +1,408 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newPrismaMigration(db *gorm.DB, opts ...gen.DOOption) prismaMigration { + _prismaMigration := prismaMigration{} + + _prismaMigration.prismaMigrationDo.UseDB(db, opts...) + _prismaMigration.prismaMigrationDo.UseModel(&model.PrismaMigration{}) + + tableName := _prismaMigration.prismaMigrationDo.TableName() + _prismaMigration.ALL = field.NewAsterisk(tableName) + _prismaMigration.ID = field.NewString(tableName, "id") + _prismaMigration.Checksum = field.NewString(tableName, "checksum") + _prismaMigration.FinishedAt = field.NewTime(tableName, "finished_at") + _prismaMigration.MigrationName = field.NewString(tableName, "migration_name") + _prismaMigration.Logs = field.NewString(tableName, "logs") + _prismaMigration.RolledBackAt = field.NewTime(tableName, "rolled_back_at") + _prismaMigration.StartedAt = field.NewTime(tableName, "started_at") + _prismaMigration.AppliedStepsCount = field.NewInt32(tableName, "applied_steps_count") + + _prismaMigration.fillFieldMap() + + return _prismaMigration +} + +type prismaMigration struct { + prismaMigrationDo + + ALL field.Asterisk + ID field.String + Checksum field.String + FinishedAt field.Time + MigrationName field.String + Logs field.String + RolledBackAt field.Time + StartedAt field.Time + AppliedStepsCount field.Int32 + + fieldMap map[string]field.Expr +} + +func (p prismaMigration) Table(newTableName string) *prismaMigration { + p.prismaMigrationDo.UseTable(newTableName) + return p.updateTableName(newTableName) +} + +func (p prismaMigration) As(alias string) *prismaMigration { + p.prismaMigrationDo.DO = *(p.prismaMigrationDo.As(alias).(*gen.DO)) + return p.updateTableName(alias) +} + +func (p *prismaMigration) updateTableName(table string) *prismaMigration { + p.ALL = field.NewAsterisk(table) + p.ID = field.NewString(table, "id") + p.Checksum = field.NewString(table, "checksum") + p.FinishedAt = field.NewTime(table, "finished_at") + p.MigrationName = field.NewString(table, "migration_name") + p.Logs = field.NewString(table, "logs") + p.RolledBackAt = field.NewTime(table, "rolled_back_at") + p.StartedAt = field.NewTime(table, "started_at") + p.AppliedStepsCount = field.NewInt32(table, "applied_steps_count") + + p.fillFieldMap() + + return p +} + +func (p *prismaMigration) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := p.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (p *prismaMigration) fillFieldMap() { + p.fieldMap = make(map[string]field.Expr, 8) + p.fieldMap["id"] = p.ID + p.fieldMap["checksum"] = p.Checksum + p.fieldMap["finished_at"] = p.FinishedAt + p.fieldMap["migration_name"] = p.MigrationName + p.fieldMap["logs"] = p.Logs + p.fieldMap["rolled_back_at"] = p.RolledBackAt + p.fieldMap["started_at"] = p.StartedAt + p.fieldMap["applied_steps_count"] = p.AppliedStepsCount +} + +func (p prismaMigration) clone(db *gorm.DB) prismaMigration { + p.prismaMigrationDo.ReplaceConnPool(db.Statement.ConnPool) + return p +} + +func (p prismaMigration) replaceDB(db *gorm.DB) prismaMigration { + p.prismaMigrationDo.ReplaceDB(db) + return p +} + +type prismaMigrationDo struct{ gen.DO } + +type IPrismaMigrationDo interface { + gen.SubQuery + Debug() IPrismaMigrationDo + WithContext(ctx context.Context) IPrismaMigrationDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IPrismaMigrationDo + WriteDB() IPrismaMigrationDo + As(alias string) gen.Dao + Session(config *gorm.Session) IPrismaMigrationDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IPrismaMigrationDo + Not(conds ...gen.Condition) IPrismaMigrationDo + Or(conds ...gen.Condition) IPrismaMigrationDo + Select(conds ...field.Expr) IPrismaMigrationDo + Where(conds ...gen.Condition) IPrismaMigrationDo + Order(conds ...field.Expr) IPrismaMigrationDo + Distinct(cols ...field.Expr) IPrismaMigrationDo + Omit(cols ...field.Expr) IPrismaMigrationDo + Join(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo + LeftJoin(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo + RightJoin(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo + Group(cols ...field.Expr) IPrismaMigrationDo + Having(conds ...gen.Condition) IPrismaMigrationDo + Limit(limit int) IPrismaMigrationDo + Offset(offset int) IPrismaMigrationDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IPrismaMigrationDo + Unscoped() IPrismaMigrationDo + Create(values ...*model.PrismaMigration) error + CreateInBatches(values []*model.PrismaMigration, batchSize int) error + Save(values ...*model.PrismaMigration) error + First() (*model.PrismaMigration, error) + Take() (*model.PrismaMigration, error) + Last() (*model.PrismaMigration, error) + Find() ([]*model.PrismaMigration, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PrismaMigration, err error) + FindInBatches(result *[]*model.PrismaMigration, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.PrismaMigration) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IPrismaMigrationDo + Assign(attrs ...field.AssignExpr) IPrismaMigrationDo + Joins(fields ...field.RelationField) IPrismaMigrationDo + Preload(fields ...field.RelationField) IPrismaMigrationDo + FirstOrInit() (*model.PrismaMigration, error) + FirstOrCreate() (*model.PrismaMigration, error) + FindByPage(offset int, limit int) (result []*model.PrismaMigration, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IPrismaMigrationDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (p prismaMigrationDo) Debug() IPrismaMigrationDo { + return p.withDO(p.DO.Debug()) +} + +func (p prismaMigrationDo) WithContext(ctx context.Context) IPrismaMigrationDo { + return p.withDO(p.DO.WithContext(ctx)) +} + +func (p prismaMigrationDo) ReadDB() IPrismaMigrationDo { + return p.Clauses(dbresolver.Read) +} + +func (p prismaMigrationDo) WriteDB() IPrismaMigrationDo { + return p.Clauses(dbresolver.Write) +} + +func (p prismaMigrationDo) Session(config *gorm.Session) IPrismaMigrationDo { + return p.withDO(p.DO.Session(config)) +} + +func (p prismaMigrationDo) Clauses(conds ...clause.Expression) IPrismaMigrationDo { + return p.withDO(p.DO.Clauses(conds...)) +} + +func (p prismaMigrationDo) Returning(value interface{}, columns ...string) IPrismaMigrationDo { + return p.withDO(p.DO.Returning(value, columns...)) +} + +func (p prismaMigrationDo) Not(conds ...gen.Condition) IPrismaMigrationDo { + return p.withDO(p.DO.Not(conds...)) +} + +func (p prismaMigrationDo) Or(conds ...gen.Condition) IPrismaMigrationDo { + return p.withDO(p.DO.Or(conds...)) +} + +func (p prismaMigrationDo) Select(conds ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Select(conds...)) +} + +func (p prismaMigrationDo) Where(conds ...gen.Condition) IPrismaMigrationDo { + return p.withDO(p.DO.Where(conds...)) +} + +func (p prismaMigrationDo) Order(conds ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Order(conds...)) +} + +func (p prismaMigrationDo) Distinct(cols ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Distinct(cols...)) +} + +func (p prismaMigrationDo) Omit(cols ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Omit(cols...)) +} + +func (p prismaMigrationDo) Join(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Join(table, on...)) +} + +func (p prismaMigrationDo) LeftJoin(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.LeftJoin(table, on...)) +} + +func (p prismaMigrationDo) RightJoin(table schema.Tabler, on ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.RightJoin(table, on...)) +} + +func (p prismaMigrationDo) Group(cols ...field.Expr) IPrismaMigrationDo { + return p.withDO(p.DO.Group(cols...)) +} + +func (p prismaMigrationDo) Having(conds ...gen.Condition) IPrismaMigrationDo { + return p.withDO(p.DO.Having(conds...)) +} + +func (p prismaMigrationDo) Limit(limit int) IPrismaMigrationDo { + return p.withDO(p.DO.Limit(limit)) +} + +func (p prismaMigrationDo) Offset(offset int) IPrismaMigrationDo { + return p.withDO(p.DO.Offset(offset)) +} + +func (p prismaMigrationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IPrismaMigrationDo { + return p.withDO(p.DO.Scopes(funcs...)) +} + +func (p prismaMigrationDo) Unscoped() IPrismaMigrationDo { + return p.withDO(p.DO.Unscoped()) +} + +func (p prismaMigrationDo) Create(values ...*model.PrismaMigration) error { + if len(values) == 0 { + return nil + } + return p.DO.Create(values) +} + +func (p prismaMigrationDo) CreateInBatches(values []*model.PrismaMigration, batchSize int) error { + return p.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (p prismaMigrationDo) Save(values ...*model.PrismaMigration) error { + if len(values) == 0 { + return nil + } + return p.DO.Save(values) +} + +func (p prismaMigrationDo) First() (*model.PrismaMigration, error) { + if result, err := p.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.PrismaMigration), nil + } +} + +func (p prismaMigrationDo) Take() (*model.PrismaMigration, error) { + if result, err := p.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.PrismaMigration), nil + } +} + +func (p prismaMigrationDo) Last() (*model.PrismaMigration, error) { + if result, err := p.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.PrismaMigration), nil + } +} + +func (p prismaMigrationDo) Find() ([]*model.PrismaMigration, error) { + result, err := p.DO.Find() + return result.([]*model.PrismaMigration), err +} + +func (p prismaMigrationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PrismaMigration, err error) { + buf := make([]*model.PrismaMigration, 0, batchSize) + err = p.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (p prismaMigrationDo) FindInBatches(result *[]*model.PrismaMigration, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return p.DO.FindInBatches(result, batchSize, fc) +} + +func (p prismaMigrationDo) Attrs(attrs ...field.AssignExpr) IPrismaMigrationDo { + return p.withDO(p.DO.Attrs(attrs...)) +} + +func (p prismaMigrationDo) Assign(attrs ...field.AssignExpr) IPrismaMigrationDo { + return p.withDO(p.DO.Assign(attrs...)) +} + +func (p prismaMigrationDo) Joins(fields ...field.RelationField) IPrismaMigrationDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Joins(_f)) + } + return &p +} + +func (p prismaMigrationDo) Preload(fields ...field.RelationField) IPrismaMigrationDo { + for _, _f := range fields { + p = *p.withDO(p.DO.Preload(_f)) + } + return &p +} + +func (p prismaMigrationDo) FirstOrInit() (*model.PrismaMigration, error) { + if result, err := p.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.PrismaMigration), nil + } +} + +func (p prismaMigrationDo) FirstOrCreate() (*model.PrismaMigration, error) { + if result, err := p.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.PrismaMigration), nil + } +} + +func (p prismaMigrationDo) FindByPage(offset int, limit int) (result []*model.PrismaMigration, count int64, err error) { + result, err = p.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = p.Offset(-1).Limit(-1).Count() + return +} + +func (p prismaMigrationDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = p.Count() + if err != nil { + return + } + + err = p.Offset(offset).Limit(limit).Scan(result) + return +} + +func (p prismaMigrationDo) Scan(result interface{}) (err error) { + return p.DO.Scan(result) +} + +func (p prismaMigrationDo) Delete(models ...*model.PrismaMigration) (result gen.ResultInfo, err error) { + return p.DO.Delete(models) +} + +func (p *prismaMigrationDo) withDO(do gen.Dao) *prismaMigrationDo { + p.DO = *do.(*gen.DO) + return p +} diff --git a/pkg/models/_prisma_migrations.gen_test.go b/pkg/models/_prisma_migrations.gen_test.go new file mode 100644 index 0000000..5051958 --- /dev/null +++ b/pkg/models/_prisma_migrations.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.PrismaMigration{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.PrismaMigration{}) fail: %s", err) + } +} + +func Test_prismaMigrationQuery(t *testing.T) { + prismaMigration := newPrismaMigration(db) + prismaMigration = *prismaMigration.As(prismaMigration.TableName()) + _do := prismaMigration.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(prismaMigration.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table <_prisma_migrations> fail:", err) + return + } + + _, ok := prismaMigration.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from prismaMigration success") + } + + err = _do.Create(&model.PrismaMigration{}) + if err != nil { + t.Error("create item in table <_prisma_migrations> fail:", err) + } + + err = _do.Save(&model.PrismaMigration{}) + if err != nil { + t.Error("create item in table <_prisma_migrations> fail:", err) + } + + err = _do.CreateInBatches([]*model.PrismaMigration{{}, {}}, 10) + if err != nil { + t.Error("create item in table <_prisma_migrations> fail:", err) + } + + _, err = _do.Select(prismaMigration.ALL).Take() + if err != nil { + t.Error("Take() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table <_prisma_migrations> fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.PrismaMigration{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Select(prismaMigration.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Select(prismaMigration.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table <_prisma_migrations> fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.ScanByPage(&model.PrismaMigration{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table <_prisma_migrations> fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table <_prisma_migrations> fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table <_prisma_migrations> fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table <_prisma_migrations> fail:", err) + } +} diff --git a/pkg/models/account.gen.go b/pkg/models/account.gen.go new file mode 100644 index 0000000..a6e2619 --- /dev/null +++ b/pkg/models/account.gen.go @@ -0,0 +1,408 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newAccount(db *gorm.DB, opts ...gen.DOOption) account { + _account := account{} + + _account.accountDo.UseDB(db, opts...) + _account.accountDo.UseModel(&model.Account{}) + + tableName := _account.accountDo.TableName() + _account.ALL = field.NewAsterisk(tableName) + _account.ID = field.NewString(tableName, "id") + _account.UserID = field.NewString(tableName, "userId") + _account.Provider = field.NewString(tableName, "provider") + _account.ProviderAccountID = field.NewString(tableName, "providerAccountId") + _account.ProviderRefreshToken = field.NewString(tableName, "providerRefreshToken") + _account.ProviderAccessToken = field.NewString(tableName, "providerAccessToken") + _account.ProviderScope = field.NewString(tableName, "providerScope") + _account.LoggedIn = field.NewTime(tableName, "loggedIn") + + _account.fillFieldMap() + + return _account +} + +type account struct { + accountDo + + ALL field.Asterisk + ID field.String + UserID field.String + Provider field.String + ProviderAccountID field.String + ProviderRefreshToken field.String + ProviderAccessToken field.String + ProviderScope field.String + LoggedIn field.Time + + fieldMap map[string]field.Expr +} + +func (a account) Table(newTableName string) *account { + a.accountDo.UseTable(newTableName) + return a.updateTableName(newTableName) +} + +func (a account) As(alias string) *account { + a.accountDo.DO = *(a.accountDo.As(alias).(*gen.DO)) + return a.updateTableName(alias) +} + +func (a *account) updateTableName(table string) *account { + a.ALL = field.NewAsterisk(table) + a.ID = field.NewString(table, "id") + a.UserID = field.NewString(table, "userId") + a.Provider = field.NewString(table, "provider") + a.ProviderAccountID = field.NewString(table, "providerAccountId") + a.ProviderRefreshToken = field.NewString(table, "providerRefreshToken") + a.ProviderAccessToken = field.NewString(table, "providerAccessToken") + a.ProviderScope = field.NewString(table, "providerScope") + a.LoggedIn = field.NewTime(table, "loggedIn") + + a.fillFieldMap() + + return a +} + +func (a *account) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := a.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (a *account) fillFieldMap() { + a.fieldMap = make(map[string]field.Expr, 8) + a.fieldMap["id"] = a.ID + a.fieldMap["userId"] = a.UserID + a.fieldMap["provider"] = a.Provider + a.fieldMap["providerAccountId"] = a.ProviderAccountID + a.fieldMap["providerRefreshToken"] = a.ProviderRefreshToken + a.fieldMap["providerAccessToken"] = a.ProviderAccessToken + a.fieldMap["providerScope"] = a.ProviderScope + a.fieldMap["loggedIn"] = a.LoggedIn +} + +func (a account) clone(db *gorm.DB) account { + a.accountDo.ReplaceConnPool(db.Statement.ConnPool) + return a +} + +func (a account) replaceDB(db *gorm.DB) account { + a.accountDo.ReplaceDB(db) + return a +} + +type accountDo struct{ gen.DO } + +type IAccountDo interface { + gen.SubQuery + Debug() IAccountDo + WithContext(ctx context.Context) IAccountDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IAccountDo + WriteDB() IAccountDo + As(alias string) gen.Dao + Session(config *gorm.Session) IAccountDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IAccountDo + Not(conds ...gen.Condition) IAccountDo + Or(conds ...gen.Condition) IAccountDo + Select(conds ...field.Expr) IAccountDo + Where(conds ...gen.Condition) IAccountDo + Order(conds ...field.Expr) IAccountDo + Distinct(cols ...field.Expr) IAccountDo + Omit(cols ...field.Expr) IAccountDo + Join(table schema.Tabler, on ...field.Expr) IAccountDo + LeftJoin(table schema.Tabler, on ...field.Expr) IAccountDo + RightJoin(table schema.Tabler, on ...field.Expr) IAccountDo + Group(cols ...field.Expr) IAccountDo + Having(conds ...gen.Condition) IAccountDo + Limit(limit int) IAccountDo + Offset(offset int) IAccountDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IAccountDo + Unscoped() IAccountDo + Create(values ...*model.Account) error + CreateInBatches(values []*model.Account, batchSize int) error + Save(values ...*model.Account) error + First() (*model.Account, error) + Take() (*model.Account, error) + Last() (*model.Account, error) + Find() ([]*model.Account, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Account, err error) + FindInBatches(result *[]*model.Account, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Account) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IAccountDo + Assign(attrs ...field.AssignExpr) IAccountDo + Joins(fields ...field.RelationField) IAccountDo + Preload(fields ...field.RelationField) IAccountDo + FirstOrInit() (*model.Account, error) + FirstOrCreate() (*model.Account, error) + FindByPage(offset int, limit int) (result []*model.Account, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IAccountDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (a accountDo) Debug() IAccountDo { + return a.withDO(a.DO.Debug()) +} + +func (a accountDo) WithContext(ctx context.Context) IAccountDo { + return a.withDO(a.DO.WithContext(ctx)) +} + +func (a accountDo) ReadDB() IAccountDo { + return a.Clauses(dbresolver.Read) +} + +func (a accountDo) WriteDB() IAccountDo { + return a.Clauses(dbresolver.Write) +} + +func (a accountDo) Session(config *gorm.Session) IAccountDo { + return a.withDO(a.DO.Session(config)) +} + +func (a accountDo) Clauses(conds ...clause.Expression) IAccountDo { + return a.withDO(a.DO.Clauses(conds...)) +} + +func (a accountDo) Returning(value interface{}, columns ...string) IAccountDo { + return a.withDO(a.DO.Returning(value, columns...)) +} + +func (a accountDo) Not(conds ...gen.Condition) IAccountDo { + return a.withDO(a.DO.Not(conds...)) +} + +func (a accountDo) Or(conds ...gen.Condition) IAccountDo { + return a.withDO(a.DO.Or(conds...)) +} + +func (a accountDo) Select(conds ...field.Expr) IAccountDo { + return a.withDO(a.DO.Select(conds...)) +} + +func (a accountDo) Where(conds ...gen.Condition) IAccountDo { + return a.withDO(a.DO.Where(conds...)) +} + +func (a accountDo) Order(conds ...field.Expr) IAccountDo { + return a.withDO(a.DO.Order(conds...)) +} + +func (a accountDo) Distinct(cols ...field.Expr) IAccountDo { + return a.withDO(a.DO.Distinct(cols...)) +} + +func (a accountDo) Omit(cols ...field.Expr) IAccountDo { + return a.withDO(a.DO.Omit(cols...)) +} + +func (a accountDo) Join(table schema.Tabler, on ...field.Expr) IAccountDo { + return a.withDO(a.DO.Join(table, on...)) +} + +func (a accountDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAccountDo { + return a.withDO(a.DO.LeftJoin(table, on...)) +} + +func (a accountDo) RightJoin(table schema.Tabler, on ...field.Expr) IAccountDo { + return a.withDO(a.DO.RightJoin(table, on...)) +} + +func (a accountDo) Group(cols ...field.Expr) IAccountDo { + return a.withDO(a.DO.Group(cols...)) +} + +func (a accountDo) Having(conds ...gen.Condition) IAccountDo { + return a.withDO(a.DO.Having(conds...)) +} + +func (a accountDo) Limit(limit int) IAccountDo { + return a.withDO(a.DO.Limit(limit)) +} + +func (a accountDo) Offset(offset int) IAccountDo { + return a.withDO(a.DO.Offset(offset)) +} + +func (a accountDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAccountDo { + return a.withDO(a.DO.Scopes(funcs...)) +} + +func (a accountDo) Unscoped() IAccountDo { + return a.withDO(a.DO.Unscoped()) +} + +func (a accountDo) Create(values ...*model.Account) error { + if len(values) == 0 { + return nil + } + return a.DO.Create(values) +} + +func (a accountDo) CreateInBatches(values []*model.Account, batchSize int) error { + return a.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (a accountDo) Save(values ...*model.Account) error { + if len(values) == 0 { + return nil + } + return a.DO.Save(values) +} + +func (a accountDo) First() (*model.Account, error) { + if result, err := a.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Account), nil + } +} + +func (a accountDo) Take() (*model.Account, error) { + if result, err := a.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Account), nil + } +} + +func (a accountDo) Last() (*model.Account, error) { + if result, err := a.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Account), nil + } +} + +func (a accountDo) Find() ([]*model.Account, error) { + result, err := a.DO.Find() + return result.([]*model.Account), err +} + +func (a accountDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Account, err error) { + buf := make([]*model.Account, 0, batchSize) + err = a.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (a accountDo) FindInBatches(result *[]*model.Account, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return a.DO.FindInBatches(result, batchSize, fc) +} + +func (a accountDo) Attrs(attrs ...field.AssignExpr) IAccountDo { + return a.withDO(a.DO.Attrs(attrs...)) +} + +func (a accountDo) Assign(attrs ...field.AssignExpr) IAccountDo { + return a.withDO(a.DO.Assign(attrs...)) +} + +func (a accountDo) Joins(fields ...field.RelationField) IAccountDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Joins(_f)) + } + return &a +} + +func (a accountDo) Preload(fields ...field.RelationField) IAccountDo { + for _, _f := range fields { + a = *a.withDO(a.DO.Preload(_f)) + } + return &a +} + +func (a accountDo) FirstOrInit() (*model.Account, error) { + if result, err := a.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Account), nil + } +} + +func (a accountDo) FirstOrCreate() (*model.Account, error) { + if result, err := a.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Account), nil + } +} + +func (a accountDo) FindByPage(offset int, limit int) (result []*model.Account, count int64, err error) { + result, err = a.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = a.Offset(-1).Limit(-1).Count() + return +} + +func (a accountDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = a.Count() + if err != nil { + return + } + + err = a.Offset(offset).Limit(limit).Scan(result) + return +} + +func (a accountDo) Scan(result interface{}) (err error) { + return a.DO.Scan(result) +} + +func (a accountDo) Delete(models ...*model.Account) (result gen.ResultInfo, err error) { + return a.DO.Delete(models) +} + +func (a *accountDo) withDO(do gen.Dao) *accountDo { + a.DO = *do.(*gen.DO) + return a +} diff --git a/pkg/models/account.gen_test.go b/pkg/models/account.gen_test.go new file mode 100644 index 0000000..61db925 --- /dev/null +++ b/pkg/models/account.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.Account{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.Account{}) fail: %s", err) + } +} + +func Test_accountQuery(t *testing.T) { + account := newAccount(db) + account = *account.As(account.TableName()) + _do := account.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(account.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := account.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from account success") + } + + err = _do.Create(&model.Account{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.Account{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.Account{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(account.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.Account{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(account.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(account.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.Account{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/gen.go b/pkg/models/gen.go new file mode 100644 index 0000000..39f388f --- /dev/null +++ b/pkg/models/gen.go @@ -0,0 +1,231 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "database/sql" + + "gorm.io/gorm" + + "gorm.io/gen" + + "gorm.io/plugin/dbresolver" +) + +var ( + Q = new(Query) + Account *account + InfraConfig *infraConfig + InvitedUser *invitedUser + Shortcode *shortcode + Team *team + TeamCollection *teamCollection + TeamEnvironment *teamEnvironment + TeamInvitation *teamInvitation + TeamMember *teamMember + TeamRequest *teamRequest + User *user + UserCollection *userCollection + UserEnvironment *userEnvironment + UserHistory *userHistory + UserRequest *userRequest + UserSetting *userSetting + VerificationToken *verificationToken +) + +func SetDefault(db *gorm.DB, opts ...gen.DOOption) { + *Q = *Use(db, opts...) + Account = &Q.Account + InfraConfig = &Q.InfraConfig + InvitedUser = &Q.InvitedUser + Shortcode = &Q.Shortcode + Team = &Q.Team + TeamCollection = &Q.TeamCollection + TeamEnvironment = &Q.TeamEnvironment + TeamInvitation = &Q.TeamInvitation + TeamMember = &Q.TeamMember + TeamRequest = &Q.TeamRequest + User = &Q.User + UserCollection = &Q.UserCollection + UserEnvironment = &Q.UserEnvironment + UserHistory = &Q.UserHistory + UserRequest = &Q.UserRequest + UserSetting = &Q.UserSetting + VerificationToken = &Q.VerificationToken +} + +func Use(db *gorm.DB, opts ...gen.DOOption) *Query { + return &Query{ + db: db, + Account: newAccount(db, opts...), + InfraConfig: newInfraConfig(db, opts...), + InvitedUser: newInvitedUser(db, opts...), + Shortcode: newShortcode(db, opts...), + Team: newTeam(db, opts...), + TeamCollection: newTeamCollection(db, opts...), + TeamEnvironment: newTeamEnvironment(db, opts...), + TeamInvitation: newTeamInvitation(db, opts...), + TeamMember: newTeamMember(db, opts...), + TeamRequest: newTeamRequest(db, opts...), + User: newUser(db, opts...), + UserCollection: newUserCollection(db, opts...), + UserEnvironment: newUserEnvironment(db, opts...), + UserHistory: newUserHistory(db, opts...), + UserRequest: newUserRequest(db, opts...), + UserSetting: newUserSetting(db, opts...), + VerificationToken: newVerificationToken(db, opts...), + } +} + +type Query struct { + db *gorm.DB + + Account account + InfraConfig infraConfig + InvitedUser invitedUser + Shortcode shortcode + Team team + TeamCollection teamCollection + TeamEnvironment teamEnvironment + TeamInvitation teamInvitation + TeamMember teamMember + TeamRequest teamRequest + User user + UserCollection userCollection + UserEnvironment userEnvironment + UserHistory userHistory + UserRequest userRequest + UserSetting userSetting + VerificationToken verificationToken +} + +func (q *Query) Available() bool { return q.db != nil } + +func (q *Query) clone(db *gorm.DB) *Query { + return &Query{ + db: db, + Account: q.Account.clone(db), + InfraConfig: q.InfraConfig.clone(db), + InvitedUser: q.InvitedUser.clone(db), + Shortcode: q.Shortcode.clone(db), + Team: q.Team.clone(db), + TeamCollection: q.TeamCollection.clone(db), + TeamEnvironment: q.TeamEnvironment.clone(db), + TeamInvitation: q.TeamInvitation.clone(db), + TeamMember: q.TeamMember.clone(db), + TeamRequest: q.TeamRequest.clone(db), + User: q.User.clone(db), + UserCollection: q.UserCollection.clone(db), + UserEnvironment: q.UserEnvironment.clone(db), + UserHistory: q.UserHistory.clone(db), + UserRequest: q.UserRequest.clone(db), + UserSetting: q.UserSetting.clone(db), + VerificationToken: q.VerificationToken.clone(db), + } +} + +func (q *Query) ReadDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Read)) +} + +func (q *Query) WriteDB() *Query { + return q.ReplaceDB(q.db.Clauses(dbresolver.Write)) +} + +func (q *Query) ReplaceDB(db *gorm.DB) *Query { + return &Query{ + db: db, + Account: q.Account.replaceDB(db), + InfraConfig: q.InfraConfig.replaceDB(db), + InvitedUser: q.InvitedUser.replaceDB(db), + Shortcode: q.Shortcode.replaceDB(db), + Team: q.Team.replaceDB(db), + TeamCollection: q.TeamCollection.replaceDB(db), + TeamEnvironment: q.TeamEnvironment.replaceDB(db), + TeamInvitation: q.TeamInvitation.replaceDB(db), + TeamMember: q.TeamMember.replaceDB(db), + TeamRequest: q.TeamRequest.replaceDB(db), + User: q.User.replaceDB(db), + UserCollection: q.UserCollection.replaceDB(db), + UserEnvironment: q.UserEnvironment.replaceDB(db), + UserHistory: q.UserHistory.replaceDB(db), + UserRequest: q.UserRequest.replaceDB(db), + UserSetting: q.UserSetting.replaceDB(db), + VerificationToken: q.VerificationToken.replaceDB(db), + } +} + +type queryCtx struct { + Account IAccountDo + InfraConfig IInfraConfigDo + InvitedUser IInvitedUserDo + Shortcode IShortcodeDo + Team ITeamDo + TeamCollection ITeamCollectionDo + TeamEnvironment ITeamEnvironmentDo + TeamInvitation ITeamInvitationDo + TeamMember ITeamMemberDo + TeamRequest ITeamRequestDo + User IUserDo + UserCollection IUserCollectionDo + UserEnvironment IUserEnvironmentDo + UserHistory IUserHistoryDo + UserRequest IUserRequestDo + UserSetting IUserSettingDo + VerificationToken IVerificationTokenDo +} + +func (q *Query) WithContext(ctx context.Context) *queryCtx { + return &queryCtx{ + Account: q.Account.WithContext(ctx), + InfraConfig: q.InfraConfig.WithContext(ctx), + InvitedUser: q.InvitedUser.WithContext(ctx), + Shortcode: q.Shortcode.WithContext(ctx), + Team: q.Team.WithContext(ctx), + TeamCollection: q.TeamCollection.WithContext(ctx), + TeamEnvironment: q.TeamEnvironment.WithContext(ctx), + TeamInvitation: q.TeamInvitation.WithContext(ctx), + TeamMember: q.TeamMember.WithContext(ctx), + TeamRequest: q.TeamRequest.WithContext(ctx), + User: q.User.WithContext(ctx), + UserCollection: q.UserCollection.WithContext(ctx), + UserEnvironment: q.UserEnvironment.WithContext(ctx), + UserHistory: q.UserHistory.WithContext(ctx), + UserRequest: q.UserRequest.WithContext(ctx), + UserSetting: q.UserSetting.WithContext(ctx), + VerificationToken: q.VerificationToken.WithContext(ctx), + } +} + +func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error { + return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...) +} + +func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx { + tx := q.db.Begin(opts...) + return &QueryTx{Query: q.clone(tx), Error: tx.Error} +} + +type QueryTx struct { + *Query + Error error +} + +func (q *QueryTx) Commit() error { + return q.db.Commit().Error +} + +func (q *QueryTx) Rollback() error { + return q.db.Rollback().Error +} + +func (q *QueryTx) SavePoint(name string) error { + return q.db.SavePoint(name).Error +} + +func (q *QueryTx) RollbackTo(name string) error { + return q.db.RollbackTo(name).Error +} diff --git a/pkg/models/gen_test.go b/pkg/models/gen_test.go new file mode 100644 index 0000000..feb64a1 --- /dev/null +++ b/pkg/models/gen_test.go @@ -0,0 +1,134 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "reflect" + "sync" + "testing" + + "gorm.io/driver/sqlite" + "gorm.io/gorm" +) + +type Input struct { + Args []interface{} +} + +type Expectation struct { + Ret []interface{} +} + +type TestCase struct { + Input + Expectation +} + +const dbName = "gen_test.db" + +var db *gorm.DB +var once sync.Once + +func init() { + InitializeDB() + db.AutoMigrate(&_another{}) +} + +func InitializeDB() { + once.Do(func() { + var err error + db, err = gorm.Open(sqlite.Open(dbName), &gorm.Config{}) + if err != nil { + panic(fmt.Errorf("open sqlite %q fail: %w", dbName, err)) + } + }) +} + +func assert(t *testing.T, methodName string, res, exp interface{}) { + if !reflect.DeepEqual(res, exp) { + t.Errorf("%v() gotResult = %v, want %v", methodName, res, exp) + } +} + +type _another struct { + ID uint64 `gorm:"primaryKey"` +} + +func (*_another) TableName() string { return "another_for_unit_test" } + +func Test_Available(t *testing.T) { + if !Use(db).Available() { + t.Errorf("query.Available() == false") + } +} + +func Test_WithContext(t *testing.T) { + query := Use(db) + if !query.Available() { + t.Errorf("query Use(db) fail: query.Available() == false") + } + + type Content string + var key, value Content = "gen_tag", "unit_test" + qCtx := query.WithContext(context.WithValue(context.Background(), key, value)) + + for _, ctx := range []context.Context{ + qCtx.Account.UnderlyingDB().Statement.Context, + qCtx.InfraConfig.UnderlyingDB().Statement.Context, + qCtx.InvitedUser.UnderlyingDB().Statement.Context, + qCtx.Shortcode.UnderlyingDB().Statement.Context, + qCtx.Team.UnderlyingDB().Statement.Context, + qCtx.TeamCollection.UnderlyingDB().Statement.Context, + qCtx.TeamEnvironment.UnderlyingDB().Statement.Context, + qCtx.TeamInvitation.UnderlyingDB().Statement.Context, + qCtx.TeamMember.UnderlyingDB().Statement.Context, + qCtx.TeamRequest.UnderlyingDB().Statement.Context, + qCtx.User.UnderlyingDB().Statement.Context, + qCtx.UserCollection.UnderlyingDB().Statement.Context, + qCtx.UserEnvironment.UnderlyingDB().Statement.Context, + qCtx.UserHistory.UnderlyingDB().Statement.Context, + qCtx.UserRequest.UnderlyingDB().Statement.Context, + qCtx.UserSetting.UnderlyingDB().Statement.Context, + qCtx.VerificationToken.UnderlyingDB().Statement.Context, + } { + if v := ctx.Value(key); v != value { + t.Errorf("get value from context fail, expect %q, got %q", value, v) + } + } +} + +func Test_Transaction(t *testing.T) { + query := Use(db) + if !query.Available() { + t.Errorf("query Use(db) fail: query.Available() == false") + } + + err := query.Transaction(func(tx *Query) error { return nil }) + if err != nil { + t.Errorf("query.Transaction execute fail: %s", err) + } + + tx := query.Begin() + + err = tx.SavePoint("point") + if err != nil { + t.Errorf("query tx SavePoint fail: %s", err) + } + err = tx.RollbackTo("point") + if err != nil { + t.Errorf("query tx RollbackTo fail: %s", err) + } + err = tx.Commit() + if err != nil { + t.Errorf("query tx Commit fail: %s", err) + } + + err = query.Begin().Rollback() + if err != nil { + t.Errorf("query tx Rollback fail: %s", err) + } +} diff --git a/pkg/models/go.mod b/pkg/models/go.mod new file mode 100644 index 0000000..d689cff --- /dev/null +++ b/pkg/models/go.mod @@ -0,0 +1,27 @@ +module models + +go 1.21.5 + +require ( + gorm.io/gorm v1.25.5 + gorm.io/driver/sqlite v1.5.4 + gorm.io/plugin/dbresolver v1.5.0 +) + +require ( + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.4.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + golang.org/x/crypto v0.14.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.6.0 // indirect + gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect + gorm.io/driver/mysql v1.5.1-0.20230509030346-3715c134c25b // indirect + gorm.io/hints v1.1.0 // indirect + gorm.io/plugin/dbresolver v1.3.0 // indirect +) diff --git a/pkg/models/infraconfig.gen.go b/pkg/models/infraconfig.gen.go new file mode 100644 index 0000000..bb2ae47 --- /dev/null +++ b/pkg/models/infraconfig.gen.go @@ -0,0 +1,400 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newInfraConfig(db *gorm.DB, opts ...gen.DOOption) infraConfig { + _infraConfig := infraConfig{} + + _infraConfig.infraConfigDo.UseDB(db, opts...) + _infraConfig.infraConfigDo.UseModel(&model.InfraConfig{}) + + tableName := _infraConfig.infraConfigDo.TableName() + _infraConfig.ALL = field.NewAsterisk(tableName) + _infraConfig.ID = field.NewString(tableName, "id") + _infraConfig.Name = field.NewString(tableName, "name") + _infraConfig.Value = field.NewString(tableName, "value") + _infraConfig.Active = field.NewBool(tableName, "active") + _infraConfig.CreatedOn = field.NewTime(tableName, "createdOn") + _infraConfig.UpdatedOn = field.NewTime(tableName, "updatedOn") + + _infraConfig.fillFieldMap() + + return _infraConfig +} + +type infraConfig struct { + infraConfigDo + + ALL field.Asterisk + ID field.String + Name field.String + Value field.String + Active field.Bool + CreatedOn field.Time + UpdatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (i infraConfig) Table(newTableName string) *infraConfig { + i.infraConfigDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i infraConfig) As(alias string) *infraConfig { + i.infraConfigDo.DO = *(i.infraConfigDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *infraConfig) updateTableName(table string) *infraConfig { + i.ALL = field.NewAsterisk(table) + i.ID = field.NewString(table, "id") + i.Name = field.NewString(table, "name") + i.Value = field.NewString(table, "value") + i.Active = field.NewBool(table, "active") + i.CreatedOn = field.NewTime(table, "createdOn") + i.UpdatedOn = field.NewTime(table, "updatedOn") + + i.fillFieldMap() + + return i +} + +func (i *infraConfig) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *infraConfig) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 6) + i.fieldMap["id"] = i.ID + i.fieldMap["name"] = i.Name + i.fieldMap["value"] = i.Value + i.fieldMap["active"] = i.Active + i.fieldMap["createdOn"] = i.CreatedOn + i.fieldMap["updatedOn"] = i.UpdatedOn +} + +func (i infraConfig) clone(db *gorm.DB) infraConfig { + i.infraConfigDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i infraConfig) replaceDB(db *gorm.DB) infraConfig { + i.infraConfigDo.ReplaceDB(db) + return i +} + +type infraConfigDo struct{ gen.DO } + +type IInfraConfigDo interface { + gen.SubQuery + Debug() IInfraConfigDo + WithContext(ctx context.Context) IInfraConfigDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IInfraConfigDo + WriteDB() IInfraConfigDo + As(alias string) gen.Dao + Session(config *gorm.Session) IInfraConfigDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IInfraConfigDo + Not(conds ...gen.Condition) IInfraConfigDo + Or(conds ...gen.Condition) IInfraConfigDo + Select(conds ...field.Expr) IInfraConfigDo + Where(conds ...gen.Condition) IInfraConfigDo + Order(conds ...field.Expr) IInfraConfigDo + Distinct(cols ...field.Expr) IInfraConfigDo + Omit(cols ...field.Expr) IInfraConfigDo + Join(table schema.Tabler, on ...field.Expr) IInfraConfigDo + LeftJoin(table schema.Tabler, on ...field.Expr) IInfraConfigDo + RightJoin(table schema.Tabler, on ...field.Expr) IInfraConfigDo + Group(cols ...field.Expr) IInfraConfigDo + Having(conds ...gen.Condition) IInfraConfigDo + Limit(limit int) IInfraConfigDo + Offset(offset int) IInfraConfigDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IInfraConfigDo + Unscoped() IInfraConfigDo + Create(values ...*model.InfraConfig) error + CreateInBatches(values []*model.InfraConfig, batchSize int) error + Save(values ...*model.InfraConfig) error + First() (*model.InfraConfig, error) + Take() (*model.InfraConfig, error) + Last() (*model.InfraConfig, error) + Find() ([]*model.InfraConfig, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.InfraConfig, err error) + FindInBatches(result *[]*model.InfraConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.InfraConfig) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IInfraConfigDo + Assign(attrs ...field.AssignExpr) IInfraConfigDo + Joins(fields ...field.RelationField) IInfraConfigDo + Preload(fields ...field.RelationField) IInfraConfigDo + FirstOrInit() (*model.InfraConfig, error) + FirstOrCreate() (*model.InfraConfig, error) + FindByPage(offset int, limit int) (result []*model.InfraConfig, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IInfraConfigDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (i infraConfigDo) Debug() IInfraConfigDo { + return i.withDO(i.DO.Debug()) +} + +func (i infraConfigDo) WithContext(ctx context.Context) IInfraConfigDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i infraConfigDo) ReadDB() IInfraConfigDo { + return i.Clauses(dbresolver.Read) +} + +func (i infraConfigDo) WriteDB() IInfraConfigDo { + return i.Clauses(dbresolver.Write) +} + +func (i infraConfigDo) Session(config *gorm.Session) IInfraConfigDo { + return i.withDO(i.DO.Session(config)) +} + +func (i infraConfigDo) Clauses(conds ...clause.Expression) IInfraConfigDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i infraConfigDo) Returning(value interface{}, columns ...string) IInfraConfigDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i infraConfigDo) Not(conds ...gen.Condition) IInfraConfigDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i infraConfigDo) Or(conds ...gen.Condition) IInfraConfigDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i infraConfigDo) Select(conds ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i infraConfigDo) Where(conds ...gen.Condition) IInfraConfigDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i infraConfigDo) Order(conds ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i infraConfigDo) Distinct(cols ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i infraConfigDo) Omit(cols ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i infraConfigDo) Join(table schema.Tabler, on ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i infraConfigDo) LeftJoin(table schema.Tabler, on ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i infraConfigDo) RightJoin(table schema.Tabler, on ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i infraConfigDo) Group(cols ...field.Expr) IInfraConfigDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i infraConfigDo) Having(conds ...gen.Condition) IInfraConfigDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i infraConfigDo) Limit(limit int) IInfraConfigDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i infraConfigDo) Offset(offset int) IInfraConfigDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i infraConfigDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IInfraConfigDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i infraConfigDo) Unscoped() IInfraConfigDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i infraConfigDo) Create(values ...*model.InfraConfig) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i infraConfigDo) CreateInBatches(values []*model.InfraConfig, batchSize int) error { + return i.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (i infraConfigDo) Save(values ...*model.InfraConfig) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i infraConfigDo) First() (*model.InfraConfig, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.InfraConfig), nil + } +} + +func (i infraConfigDo) Take() (*model.InfraConfig, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.InfraConfig), nil + } +} + +func (i infraConfigDo) Last() (*model.InfraConfig, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.InfraConfig), nil + } +} + +func (i infraConfigDo) Find() ([]*model.InfraConfig, error) { + result, err := i.DO.Find() + return result.([]*model.InfraConfig), err +} + +func (i infraConfigDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.InfraConfig, err error) { + buf := make([]*model.InfraConfig, 0, batchSize) + err = i.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (i infraConfigDo) FindInBatches(result *[]*model.InfraConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i infraConfigDo) Attrs(attrs ...field.AssignExpr) IInfraConfigDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i infraConfigDo) Assign(attrs ...field.AssignExpr) IInfraConfigDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i infraConfigDo) Joins(fields ...field.RelationField) IInfraConfigDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i infraConfigDo) Preload(fields ...field.RelationField) IInfraConfigDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i infraConfigDo) FirstOrInit() (*model.InfraConfig, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.InfraConfig), nil + } +} + +func (i infraConfigDo) FirstOrCreate() (*model.InfraConfig, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.InfraConfig), nil + } +} + +func (i infraConfigDo) FindByPage(offset int, limit int) (result []*model.InfraConfig, count int64, err error) { + result, err = i.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = i.Offset(-1).Limit(-1).Count() + return +} + +func (i infraConfigDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i infraConfigDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i infraConfigDo) Delete(models ...*model.InfraConfig) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *infraConfigDo) withDO(do gen.Dao) *infraConfigDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/pkg/models/infraconfig.gen_test.go b/pkg/models/infraconfig.gen_test.go new file mode 100644 index 0000000..8164635 --- /dev/null +++ b/pkg/models/infraconfig.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.InfraConfig{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.InfraConfig{}) fail: %s", err) + } +} + +func Test_infraConfigQuery(t *testing.T) { + infraConfig := newInfraConfig(db) + infraConfig = *infraConfig.As(infraConfig.TableName()) + _do := infraConfig.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(infraConfig.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := infraConfig.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from infraConfig success") + } + + err = _do.Create(&model.InfraConfig{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.InfraConfig{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.InfraConfig{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(infraConfig.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.InfraConfig{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(infraConfig.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(infraConfig.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.InfraConfig{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/invitedusers.gen.go b/pkg/models/invitedusers.gen.go new file mode 100644 index 0000000..d47710e --- /dev/null +++ b/pkg/models/invitedusers.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newInvitedUser(db *gorm.DB, opts ...gen.DOOption) invitedUser { + _invitedUser := invitedUser{} + + _invitedUser.invitedUserDo.UseDB(db, opts...) + _invitedUser.invitedUserDo.UseModel(&model.InvitedUser{}) + + tableName := _invitedUser.invitedUserDo.TableName() + _invitedUser.ALL = field.NewAsterisk(tableName) + _invitedUser.AdminUID = field.NewString(tableName, "adminUid") + _invitedUser.AdminEmail = field.NewString(tableName, "adminEmail") + _invitedUser.InviteeEmail = field.NewString(tableName, "inviteeEmail") + _invitedUser.InvitedOn = field.NewTime(tableName, "invitedOn") + + _invitedUser.fillFieldMap() + + return _invitedUser +} + +type invitedUser struct { + invitedUserDo + + ALL field.Asterisk + AdminUID field.String + AdminEmail field.String + InviteeEmail field.String + InvitedOn field.Time + + fieldMap map[string]field.Expr +} + +func (i invitedUser) Table(newTableName string) *invitedUser { + i.invitedUserDo.UseTable(newTableName) + return i.updateTableName(newTableName) +} + +func (i invitedUser) As(alias string) *invitedUser { + i.invitedUserDo.DO = *(i.invitedUserDo.As(alias).(*gen.DO)) + return i.updateTableName(alias) +} + +func (i *invitedUser) updateTableName(table string) *invitedUser { + i.ALL = field.NewAsterisk(table) + i.AdminUID = field.NewString(table, "adminUid") + i.AdminEmail = field.NewString(table, "adminEmail") + i.InviteeEmail = field.NewString(table, "inviteeEmail") + i.InvitedOn = field.NewTime(table, "invitedOn") + + i.fillFieldMap() + + return i +} + +func (i *invitedUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := i.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (i *invitedUser) fillFieldMap() { + i.fieldMap = make(map[string]field.Expr, 4) + i.fieldMap["adminUid"] = i.AdminUID + i.fieldMap["adminEmail"] = i.AdminEmail + i.fieldMap["inviteeEmail"] = i.InviteeEmail + i.fieldMap["invitedOn"] = i.InvitedOn +} + +func (i invitedUser) clone(db *gorm.DB) invitedUser { + i.invitedUserDo.ReplaceConnPool(db.Statement.ConnPool) + return i +} + +func (i invitedUser) replaceDB(db *gorm.DB) invitedUser { + i.invitedUserDo.ReplaceDB(db) + return i +} + +type invitedUserDo struct{ gen.DO } + +type IInvitedUserDo interface { + gen.SubQuery + Debug() IInvitedUserDo + WithContext(ctx context.Context) IInvitedUserDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IInvitedUserDo + WriteDB() IInvitedUserDo + As(alias string) gen.Dao + Session(config *gorm.Session) IInvitedUserDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IInvitedUserDo + Not(conds ...gen.Condition) IInvitedUserDo + Or(conds ...gen.Condition) IInvitedUserDo + Select(conds ...field.Expr) IInvitedUserDo + Where(conds ...gen.Condition) IInvitedUserDo + Order(conds ...field.Expr) IInvitedUserDo + Distinct(cols ...field.Expr) IInvitedUserDo + Omit(cols ...field.Expr) IInvitedUserDo + Join(table schema.Tabler, on ...field.Expr) IInvitedUserDo + LeftJoin(table schema.Tabler, on ...field.Expr) IInvitedUserDo + RightJoin(table schema.Tabler, on ...field.Expr) IInvitedUserDo + Group(cols ...field.Expr) IInvitedUserDo + Having(conds ...gen.Condition) IInvitedUserDo + Limit(limit int) IInvitedUserDo + Offset(offset int) IInvitedUserDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IInvitedUserDo + Unscoped() IInvitedUserDo + Create(values ...*model.InvitedUser) error + CreateInBatches(values []*model.InvitedUser, batchSize int) error + Save(values ...*model.InvitedUser) error + First() (*model.InvitedUser, error) + Take() (*model.InvitedUser, error) + Last() (*model.InvitedUser, error) + Find() ([]*model.InvitedUser, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.InvitedUser, err error) + FindInBatches(result *[]*model.InvitedUser, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.InvitedUser) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IInvitedUserDo + Assign(attrs ...field.AssignExpr) IInvitedUserDo + Joins(fields ...field.RelationField) IInvitedUserDo + Preload(fields ...field.RelationField) IInvitedUserDo + FirstOrInit() (*model.InvitedUser, error) + FirstOrCreate() (*model.InvitedUser, error) + FindByPage(offset int, limit int) (result []*model.InvitedUser, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IInvitedUserDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (i invitedUserDo) Debug() IInvitedUserDo { + return i.withDO(i.DO.Debug()) +} + +func (i invitedUserDo) WithContext(ctx context.Context) IInvitedUserDo { + return i.withDO(i.DO.WithContext(ctx)) +} + +func (i invitedUserDo) ReadDB() IInvitedUserDo { + return i.Clauses(dbresolver.Read) +} + +func (i invitedUserDo) WriteDB() IInvitedUserDo { + return i.Clauses(dbresolver.Write) +} + +func (i invitedUserDo) Session(config *gorm.Session) IInvitedUserDo { + return i.withDO(i.DO.Session(config)) +} + +func (i invitedUserDo) Clauses(conds ...clause.Expression) IInvitedUserDo { + return i.withDO(i.DO.Clauses(conds...)) +} + +func (i invitedUserDo) Returning(value interface{}, columns ...string) IInvitedUserDo { + return i.withDO(i.DO.Returning(value, columns...)) +} + +func (i invitedUserDo) Not(conds ...gen.Condition) IInvitedUserDo { + return i.withDO(i.DO.Not(conds...)) +} + +func (i invitedUserDo) Or(conds ...gen.Condition) IInvitedUserDo { + return i.withDO(i.DO.Or(conds...)) +} + +func (i invitedUserDo) Select(conds ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Select(conds...)) +} + +func (i invitedUserDo) Where(conds ...gen.Condition) IInvitedUserDo { + return i.withDO(i.DO.Where(conds...)) +} + +func (i invitedUserDo) Order(conds ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Order(conds...)) +} + +func (i invitedUserDo) Distinct(cols ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Distinct(cols...)) +} + +func (i invitedUserDo) Omit(cols ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Omit(cols...)) +} + +func (i invitedUserDo) Join(table schema.Tabler, on ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Join(table, on...)) +} + +func (i invitedUserDo) LeftJoin(table schema.Tabler, on ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.LeftJoin(table, on...)) +} + +func (i invitedUserDo) RightJoin(table schema.Tabler, on ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.RightJoin(table, on...)) +} + +func (i invitedUserDo) Group(cols ...field.Expr) IInvitedUserDo { + return i.withDO(i.DO.Group(cols...)) +} + +func (i invitedUserDo) Having(conds ...gen.Condition) IInvitedUserDo { + return i.withDO(i.DO.Having(conds...)) +} + +func (i invitedUserDo) Limit(limit int) IInvitedUserDo { + return i.withDO(i.DO.Limit(limit)) +} + +func (i invitedUserDo) Offset(offset int) IInvitedUserDo { + return i.withDO(i.DO.Offset(offset)) +} + +func (i invitedUserDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IInvitedUserDo { + return i.withDO(i.DO.Scopes(funcs...)) +} + +func (i invitedUserDo) Unscoped() IInvitedUserDo { + return i.withDO(i.DO.Unscoped()) +} + +func (i invitedUserDo) Create(values ...*model.InvitedUser) error { + if len(values) == 0 { + return nil + } + return i.DO.Create(values) +} + +func (i invitedUserDo) CreateInBatches(values []*model.InvitedUser, batchSize int) error { + return i.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (i invitedUserDo) Save(values ...*model.InvitedUser) error { + if len(values) == 0 { + return nil + } + return i.DO.Save(values) +} + +func (i invitedUserDo) First() (*model.InvitedUser, error) { + if result, err := i.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.InvitedUser), nil + } +} + +func (i invitedUserDo) Take() (*model.InvitedUser, error) { + if result, err := i.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.InvitedUser), nil + } +} + +func (i invitedUserDo) Last() (*model.InvitedUser, error) { + if result, err := i.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.InvitedUser), nil + } +} + +func (i invitedUserDo) Find() ([]*model.InvitedUser, error) { + result, err := i.DO.Find() + return result.([]*model.InvitedUser), err +} + +func (i invitedUserDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.InvitedUser, err error) { + buf := make([]*model.InvitedUser, 0, batchSize) + err = i.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (i invitedUserDo) FindInBatches(result *[]*model.InvitedUser, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return i.DO.FindInBatches(result, batchSize, fc) +} + +func (i invitedUserDo) Attrs(attrs ...field.AssignExpr) IInvitedUserDo { + return i.withDO(i.DO.Attrs(attrs...)) +} + +func (i invitedUserDo) Assign(attrs ...field.AssignExpr) IInvitedUserDo { + return i.withDO(i.DO.Assign(attrs...)) +} + +func (i invitedUserDo) Joins(fields ...field.RelationField) IInvitedUserDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Joins(_f)) + } + return &i +} + +func (i invitedUserDo) Preload(fields ...field.RelationField) IInvitedUserDo { + for _, _f := range fields { + i = *i.withDO(i.DO.Preload(_f)) + } + return &i +} + +func (i invitedUserDo) FirstOrInit() (*model.InvitedUser, error) { + if result, err := i.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.InvitedUser), nil + } +} + +func (i invitedUserDo) FirstOrCreate() (*model.InvitedUser, error) { + if result, err := i.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.InvitedUser), nil + } +} + +func (i invitedUserDo) FindByPage(offset int, limit int) (result []*model.InvitedUser, count int64, err error) { + result, err = i.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = i.Offset(-1).Limit(-1).Count() + return +} + +func (i invitedUserDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = i.Count() + if err != nil { + return + } + + err = i.Offset(offset).Limit(limit).Scan(result) + return +} + +func (i invitedUserDo) Scan(result interface{}) (err error) { + return i.DO.Scan(result) +} + +func (i invitedUserDo) Delete(models ...*model.InvitedUser) (result gen.ResultInfo, err error) { + return i.DO.Delete(models) +} + +func (i *invitedUserDo) withDO(do gen.Dao) *invitedUserDo { + i.DO = *do.(*gen.DO) + return i +} diff --git a/pkg/models/invitedusers.gen_test.go b/pkg/models/invitedusers.gen_test.go new file mode 100644 index 0000000..456b523 --- /dev/null +++ b/pkg/models/invitedusers.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.InvitedUser{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.InvitedUser{}) fail: %s", err) + } +} + +func Test_invitedUserQuery(t *testing.T) { + invitedUser := newInvitedUser(db) + invitedUser = *invitedUser.As(invitedUser.TableName()) + _do := invitedUser.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(invitedUser.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := invitedUser.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from invitedUser success") + } + + err = _do.Create(&model.InvitedUser{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.InvitedUser{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.InvitedUser{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(invitedUser.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.InvitedUser{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(invitedUser.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(invitedUser.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.InvitedUser{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/shortcode.gen.go b/pkg/models/shortcode.gen.go new file mode 100644 index 0000000..664d3e6 --- /dev/null +++ b/pkg/models/shortcode.gen.go @@ -0,0 +1,400 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newShortcode(db *gorm.DB, opts ...gen.DOOption) shortcode { + _shortcode := shortcode{} + + _shortcode.shortcodeDo.UseDB(db, opts...) + _shortcode.shortcodeDo.UseModel(&model.Shortcode{}) + + tableName := _shortcode.shortcodeDo.TableName() + _shortcode.ALL = field.NewAsterisk(tableName) + _shortcode.ID = field.NewString(tableName, "id") + _shortcode.Request = field.NewField(tableName, "request") + _shortcode.CreatorUID = field.NewString(tableName, "creatorUid") + _shortcode.CreatedOn = field.NewTime(tableName, "createdOn") + _shortcode.EmbedProperties = field.NewField(tableName, "embedProperties") + _shortcode.UpdatedOn = field.NewTime(tableName, "updatedOn") + + _shortcode.fillFieldMap() + + return _shortcode +} + +type shortcode struct { + shortcodeDo + + ALL field.Asterisk + ID field.String + Request field.Field + CreatorUID field.String + CreatedOn field.Time + EmbedProperties field.Field + UpdatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (s shortcode) Table(newTableName string) *shortcode { + s.shortcodeDo.UseTable(newTableName) + return s.updateTableName(newTableName) +} + +func (s shortcode) As(alias string) *shortcode { + s.shortcodeDo.DO = *(s.shortcodeDo.As(alias).(*gen.DO)) + return s.updateTableName(alias) +} + +func (s *shortcode) updateTableName(table string) *shortcode { + s.ALL = field.NewAsterisk(table) + s.ID = field.NewString(table, "id") + s.Request = field.NewField(table, "request") + s.CreatorUID = field.NewString(table, "creatorUid") + s.CreatedOn = field.NewTime(table, "createdOn") + s.EmbedProperties = field.NewField(table, "embedProperties") + s.UpdatedOn = field.NewTime(table, "updatedOn") + + s.fillFieldMap() + + return s +} + +func (s *shortcode) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := s.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (s *shortcode) fillFieldMap() { + s.fieldMap = make(map[string]field.Expr, 6) + s.fieldMap["id"] = s.ID + s.fieldMap["request"] = s.Request + s.fieldMap["creatorUid"] = s.CreatorUID + s.fieldMap["createdOn"] = s.CreatedOn + s.fieldMap["embedProperties"] = s.EmbedProperties + s.fieldMap["updatedOn"] = s.UpdatedOn +} + +func (s shortcode) clone(db *gorm.DB) shortcode { + s.shortcodeDo.ReplaceConnPool(db.Statement.ConnPool) + return s +} + +func (s shortcode) replaceDB(db *gorm.DB) shortcode { + s.shortcodeDo.ReplaceDB(db) + return s +} + +type shortcodeDo struct{ gen.DO } + +type IShortcodeDo interface { + gen.SubQuery + Debug() IShortcodeDo + WithContext(ctx context.Context) IShortcodeDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IShortcodeDo + WriteDB() IShortcodeDo + As(alias string) gen.Dao + Session(config *gorm.Session) IShortcodeDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IShortcodeDo + Not(conds ...gen.Condition) IShortcodeDo + Or(conds ...gen.Condition) IShortcodeDo + Select(conds ...field.Expr) IShortcodeDo + Where(conds ...gen.Condition) IShortcodeDo + Order(conds ...field.Expr) IShortcodeDo + Distinct(cols ...field.Expr) IShortcodeDo + Omit(cols ...field.Expr) IShortcodeDo + Join(table schema.Tabler, on ...field.Expr) IShortcodeDo + LeftJoin(table schema.Tabler, on ...field.Expr) IShortcodeDo + RightJoin(table schema.Tabler, on ...field.Expr) IShortcodeDo + Group(cols ...field.Expr) IShortcodeDo + Having(conds ...gen.Condition) IShortcodeDo + Limit(limit int) IShortcodeDo + Offset(offset int) IShortcodeDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IShortcodeDo + Unscoped() IShortcodeDo + Create(values ...*model.Shortcode) error + CreateInBatches(values []*model.Shortcode, batchSize int) error + Save(values ...*model.Shortcode) error + First() (*model.Shortcode, error) + Take() (*model.Shortcode, error) + Last() (*model.Shortcode, error) + Find() ([]*model.Shortcode, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Shortcode, err error) + FindInBatches(result *[]*model.Shortcode, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Shortcode) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IShortcodeDo + Assign(attrs ...field.AssignExpr) IShortcodeDo + Joins(fields ...field.RelationField) IShortcodeDo + Preload(fields ...field.RelationField) IShortcodeDo + FirstOrInit() (*model.Shortcode, error) + FirstOrCreate() (*model.Shortcode, error) + FindByPage(offset int, limit int) (result []*model.Shortcode, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IShortcodeDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (s shortcodeDo) Debug() IShortcodeDo { + return s.withDO(s.DO.Debug()) +} + +func (s shortcodeDo) WithContext(ctx context.Context) IShortcodeDo { + return s.withDO(s.DO.WithContext(ctx)) +} + +func (s shortcodeDo) ReadDB() IShortcodeDo { + return s.Clauses(dbresolver.Read) +} + +func (s shortcodeDo) WriteDB() IShortcodeDo { + return s.Clauses(dbresolver.Write) +} + +func (s shortcodeDo) Session(config *gorm.Session) IShortcodeDo { + return s.withDO(s.DO.Session(config)) +} + +func (s shortcodeDo) Clauses(conds ...clause.Expression) IShortcodeDo { + return s.withDO(s.DO.Clauses(conds...)) +} + +func (s shortcodeDo) Returning(value interface{}, columns ...string) IShortcodeDo { + return s.withDO(s.DO.Returning(value, columns...)) +} + +func (s shortcodeDo) Not(conds ...gen.Condition) IShortcodeDo { + return s.withDO(s.DO.Not(conds...)) +} + +func (s shortcodeDo) Or(conds ...gen.Condition) IShortcodeDo { + return s.withDO(s.DO.Or(conds...)) +} + +func (s shortcodeDo) Select(conds ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Select(conds...)) +} + +func (s shortcodeDo) Where(conds ...gen.Condition) IShortcodeDo { + return s.withDO(s.DO.Where(conds...)) +} + +func (s shortcodeDo) Order(conds ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Order(conds...)) +} + +func (s shortcodeDo) Distinct(cols ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Distinct(cols...)) +} + +func (s shortcodeDo) Omit(cols ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Omit(cols...)) +} + +func (s shortcodeDo) Join(table schema.Tabler, on ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Join(table, on...)) +} + +func (s shortcodeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.LeftJoin(table, on...)) +} + +func (s shortcodeDo) RightJoin(table schema.Tabler, on ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.RightJoin(table, on...)) +} + +func (s shortcodeDo) Group(cols ...field.Expr) IShortcodeDo { + return s.withDO(s.DO.Group(cols...)) +} + +func (s shortcodeDo) Having(conds ...gen.Condition) IShortcodeDo { + return s.withDO(s.DO.Having(conds...)) +} + +func (s shortcodeDo) Limit(limit int) IShortcodeDo { + return s.withDO(s.DO.Limit(limit)) +} + +func (s shortcodeDo) Offset(offset int) IShortcodeDo { + return s.withDO(s.DO.Offset(offset)) +} + +func (s shortcodeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IShortcodeDo { + return s.withDO(s.DO.Scopes(funcs...)) +} + +func (s shortcodeDo) Unscoped() IShortcodeDo { + return s.withDO(s.DO.Unscoped()) +} + +func (s shortcodeDo) Create(values ...*model.Shortcode) error { + if len(values) == 0 { + return nil + } + return s.DO.Create(values) +} + +func (s shortcodeDo) CreateInBatches(values []*model.Shortcode, batchSize int) error { + return s.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (s shortcodeDo) Save(values ...*model.Shortcode) error { + if len(values) == 0 { + return nil + } + return s.DO.Save(values) +} + +func (s shortcodeDo) First() (*model.Shortcode, error) { + if result, err := s.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Shortcode), nil + } +} + +func (s shortcodeDo) Take() (*model.Shortcode, error) { + if result, err := s.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Shortcode), nil + } +} + +func (s shortcodeDo) Last() (*model.Shortcode, error) { + if result, err := s.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Shortcode), nil + } +} + +func (s shortcodeDo) Find() ([]*model.Shortcode, error) { + result, err := s.DO.Find() + return result.([]*model.Shortcode), err +} + +func (s shortcodeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Shortcode, err error) { + buf := make([]*model.Shortcode, 0, batchSize) + err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (s shortcodeDo) FindInBatches(result *[]*model.Shortcode, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return s.DO.FindInBatches(result, batchSize, fc) +} + +func (s shortcodeDo) Attrs(attrs ...field.AssignExpr) IShortcodeDo { + return s.withDO(s.DO.Attrs(attrs...)) +} + +func (s shortcodeDo) Assign(attrs ...field.AssignExpr) IShortcodeDo { + return s.withDO(s.DO.Assign(attrs...)) +} + +func (s shortcodeDo) Joins(fields ...field.RelationField) IShortcodeDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Joins(_f)) + } + return &s +} + +func (s shortcodeDo) Preload(fields ...field.RelationField) IShortcodeDo { + for _, _f := range fields { + s = *s.withDO(s.DO.Preload(_f)) + } + return &s +} + +func (s shortcodeDo) FirstOrInit() (*model.Shortcode, error) { + if result, err := s.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Shortcode), nil + } +} + +func (s shortcodeDo) FirstOrCreate() (*model.Shortcode, error) { + if result, err := s.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Shortcode), nil + } +} + +func (s shortcodeDo) FindByPage(offset int, limit int) (result []*model.Shortcode, count int64, err error) { + result, err = s.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = s.Offset(-1).Limit(-1).Count() + return +} + +func (s shortcodeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = s.Count() + if err != nil { + return + } + + err = s.Offset(offset).Limit(limit).Scan(result) + return +} + +func (s shortcodeDo) Scan(result interface{}) (err error) { + return s.DO.Scan(result) +} + +func (s shortcodeDo) Delete(models ...*model.Shortcode) (result gen.ResultInfo, err error) { + return s.DO.Delete(models) +} + +func (s *shortcodeDo) withDO(do gen.Dao) *shortcodeDo { + s.DO = *do.(*gen.DO) + return s +} diff --git a/pkg/models/shortcode.gen_test.go b/pkg/models/shortcode.gen_test.go new file mode 100644 index 0000000..166d67e --- /dev/null +++ b/pkg/models/shortcode.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.Shortcode{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.Shortcode{}) fail: %s", err) + } +} + +func Test_shortcodeQuery(t *testing.T) { + shortcode := newShortcode(db) + shortcode = *shortcode.As(shortcode.TableName()) + _do := shortcode.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(shortcode.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := shortcode.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from shortcode success") + } + + err = _do.Create(&model.Shortcode{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.Shortcode{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.Shortcode{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(shortcode.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.Shortcode{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(shortcode.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(shortcode.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.Shortcode{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/team.gen.go b/pkg/models/team.gen.go new file mode 100644 index 0000000..069f7a6 --- /dev/null +++ b/pkg/models/team.gen.go @@ -0,0 +1,384 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeam(db *gorm.DB, opts ...gen.DOOption) team { + _team := team{} + + _team.teamDo.UseDB(db, opts...) + _team.teamDo.UseModel(&model.Team{}) + + tableName := _team.teamDo.TableName() + _team.ALL = field.NewAsterisk(tableName) + _team.ID = field.NewString(tableName, "id") + _team.Name = field.NewString(tableName, "name") + + _team.fillFieldMap() + + return _team +} + +type team struct { + teamDo + + ALL field.Asterisk + ID field.String + Name field.String + + fieldMap map[string]field.Expr +} + +func (t team) Table(newTableName string) *team { + t.teamDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t team) As(alias string) *team { + t.teamDo.DO = *(t.teamDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *team) updateTableName(table string) *team { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.Name = field.NewString(table, "name") + + t.fillFieldMap() + + return t +} + +func (t *team) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *team) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 2) + t.fieldMap["id"] = t.ID + t.fieldMap["name"] = t.Name +} + +func (t team) clone(db *gorm.DB) team { + t.teamDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t team) replaceDB(db *gorm.DB) team { + t.teamDo.ReplaceDB(db) + return t +} + +type teamDo struct{ gen.DO } + +type ITeamDo interface { + gen.SubQuery + Debug() ITeamDo + WithContext(ctx context.Context) ITeamDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamDo + WriteDB() ITeamDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamDo + Not(conds ...gen.Condition) ITeamDo + Or(conds ...gen.Condition) ITeamDo + Select(conds ...field.Expr) ITeamDo + Where(conds ...gen.Condition) ITeamDo + Order(conds ...field.Expr) ITeamDo + Distinct(cols ...field.Expr) ITeamDo + Omit(cols ...field.Expr) ITeamDo + Join(table schema.Tabler, on ...field.Expr) ITeamDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamDo + Group(cols ...field.Expr) ITeamDo + Having(conds ...gen.Condition) ITeamDo + Limit(limit int) ITeamDo + Offset(offset int) ITeamDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamDo + Unscoped() ITeamDo + Create(values ...*model.Team) error + CreateInBatches(values []*model.Team, batchSize int) error + Save(values ...*model.Team) error + First() (*model.Team, error) + Take() (*model.Team, error) + Last() (*model.Team, error) + Find() ([]*model.Team, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Team, err error) + FindInBatches(result *[]*model.Team, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.Team) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamDo + Assign(attrs ...field.AssignExpr) ITeamDo + Joins(fields ...field.RelationField) ITeamDo + Preload(fields ...field.RelationField) ITeamDo + FirstOrInit() (*model.Team, error) + FirstOrCreate() (*model.Team, error) + FindByPage(offset int, limit int) (result []*model.Team, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamDo) Debug() ITeamDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamDo) WithContext(ctx context.Context) ITeamDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamDo) ReadDB() ITeamDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamDo) WriteDB() ITeamDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamDo) Session(config *gorm.Session) ITeamDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamDo) Clauses(conds ...clause.Expression) ITeamDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamDo) Returning(value interface{}, columns ...string) ITeamDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamDo) Not(conds ...gen.Condition) ITeamDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamDo) Or(conds ...gen.Condition) ITeamDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamDo) Select(conds ...field.Expr) ITeamDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamDo) Where(conds ...gen.Condition) ITeamDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamDo) Order(conds ...field.Expr) ITeamDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamDo) Distinct(cols ...field.Expr) ITeamDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamDo) Omit(cols ...field.Expr) ITeamDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamDo) Join(table schema.Tabler, on ...field.Expr) ITeamDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamDo) Group(cols ...field.Expr) ITeamDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamDo) Having(conds ...gen.Condition) ITeamDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamDo) Limit(limit int) ITeamDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamDo) Offset(offset int) ITeamDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamDo) Unscoped() ITeamDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamDo) Create(values ...*model.Team) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamDo) CreateInBatches(values []*model.Team, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamDo) Save(values ...*model.Team) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamDo) First() (*model.Team, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.Team), nil + } +} + +func (t teamDo) Take() (*model.Team, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.Team), nil + } +} + +func (t teamDo) Last() (*model.Team, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.Team), nil + } +} + +func (t teamDo) Find() ([]*model.Team, error) { + result, err := t.DO.Find() + return result.([]*model.Team), err +} + +func (t teamDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Team, err error) { + buf := make([]*model.Team, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamDo) FindInBatches(result *[]*model.Team, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamDo) Attrs(attrs ...field.AssignExpr) ITeamDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamDo) Assign(attrs ...field.AssignExpr) ITeamDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamDo) Joins(fields ...field.RelationField) ITeamDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamDo) Preload(fields ...field.RelationField) ITeamDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamDo) FirstOrInit() (*model.Team, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.Team), nil + } +} + +func (t teamDo) FirstOrCreate() (*model.Team, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.Team), nil + } +} + +func (t teamDo) FindByPage(offset int, limit int) (result []*model.Team, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamDo) Delete(models ...*model.Team) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamDo) withDO(do gen.Dao) *teamDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/team.gen_test.go b/pkg/models/team.gen_test.go new file mode 100644 index 0000000..632b508 --- /dev/null +++ b/pkg/models/team.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.Team{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.Team{}) fail: %s", err) + } +} + +func Test_teamQuery(t *testing.T) { + team := newTeam(db) + team = *team.As(team.TableName()) + _do := team.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(team.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := team.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from team success") + } + + err = _do.Create(&model.Team{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.Team{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.Team{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(team.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.Team{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(team.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(team.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.Team{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/teamcollection.gen.go b/pkg/models/teamcollection.gen.go new file mode 100644 index 0000000..d65e3ce --- /dev/null +++ b/pkg/models/teamcollection.gen.go @@ -0,0 +1,408 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeamCollection(db *gorm.DB, opts ...gen.DOOption) teamCollection { + _teamCollection := teamCollection{} + + _teamCollection.teamCollectionDo.UseDB(db, opts...) + _teamCollection.teamCollectionDo.UseModel(&model.TeamCollection{}) + + tableName := _teamCollection.teamCollectionDo.TableName() + _teamCollection.ALL = field.NewAsterisk(tableName) + _teamCollection.ID = field.NewString(tableName, "id") + _teamCollection.ParentID = field.NewString(tableName, "parentID") + _teamCollection.TeamID = field.NewString(tableName, "teamID") + _teamCollection.Title = field.NewString(tableName, "title") + _teamCollection.OrderIndex = field.NewInt32(tableName, "orderIndex") + _teamCollection.CreatedOn = field.NewTime(tableName, "createdOn") + _teamCollection.UpdatedOn = field.NewTime(tableName, "updatedOn") + _teamCollection.Data = field.NewField(tableName, "data") + + _teamCollection.fillFieldMap() + + return _teamCollection +} + +type teamCollection struct { + teamCollectionDo + + ALL field.Asterisk + ID field.String + ParentID field.String + TeamID field.String + Title field.String + OrderIndex field.Int32 + CreatedOn field.Time + UpdatedOn field.Time + Data field.Field + + fieldMap map[string]field.Expr +} + +func (t teamCollection) Table(newTableName string) *teamCollection { + t.teamCollectionDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t teamCollection) As(alias string) *teamCollection { + t.teamCollectionDo.DO = *(t.teamCollectionDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *teamCollection) updateTableName(table string) *teamCollection { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.ParentID = field.NewString(table, "parentID") + t.TeamID = field.NewString(table, "teamID") + t.Title = field.NewString(table, "title") + t.OrderIndex = field.NewInt32(table, "orderIndex") + t.CreatedOn = field.NewTime(table, "createdOn") + t.UpdatedOn = field.NewTime(table, "updatedOn") + t.Data = field.NewField(table, "data") + + t.fillFieldMap() + + return t +} + +func (t *teamCollection) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *teamCollection) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 8) + t.fieldMap["id"] = t.ID + t.fieldMap["parentID"] = t.ParentID + t.fieldMap["teamID"] = t.TeamID + t.fieldMap["title"] = t.Title + t.fieldMap["orderIndex"] = t.OrderIndex + t.fieldMap["createdOn"] = t.CreatedOn + t.fieldMap["updatedOn"] = t.UpdatedOn + t.fieldMap["data"] = t.Data +} + +func (t teamCollection) clone(db *gorm.DB) teamCollection { + t.teamCollectionDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t teamCollection) replaceDB(db *gorm.DB) teamCollection { + t.teamCollectionDo.ReplaceDB(db) + return t +} + +type teamCollectionDo struct{ gen.DO } + +type ITeamCollectionDo interface { + gen.SubQuery + Debug() ITeamCollectionDo + WithContext(ctx context.Context) ITeamCollectionDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamCollectionDo + WriteDB() ITeamCollectionDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamCollectionDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamCollectionDo + Not(conds ...gen.Condition) ITeamCollectionDo + Or(conds ...gen.Condition) ITeamCollectionDo + Select(conds ...field.Expr) ITeamCollectionDo + Where(conds ...gen.Condition) ITeamCollectionDo + Order(conds ...field.Expr) ITeamCollectionDo + Distinct(cols ...field.Expr) ITeamCollectionDo + Omit(cols ...field.Expr) ITeamCollectionDo + Join(table schema.Tabler, on ...field.Expr) ITeamCollectionDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamCollectionDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamCollectionDo + Group(cols ...field.Expr) ITeamCollectionDo + Having(conds ...gen.Condition) ITeamCollectionDo + Limit(limit int) ITeamCollectionDo + Offset(offset int) ITeamCollectionDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamCollectionDo + Unscoped() ITeamCollectionDo + Create(values ...*model.TeamCollection) error + CreateInBatches(values []*model.TeamCollection, batchSize int) error + Save(values ...*model.TeamCollection) error + First() (*model.TeamCollection, error) + Take() (*model.TeamCollection, error) + Last() (*model.TeamCollection, error) + Find() ([]*model.TeamCollection, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamCollection, err error) + FindInBatches(result *[]*model.TeamCollection, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.TeamCollection) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamCollectionDo + Assign(attrs ...field.AssignExpr) ITeamCollectionDo + Joins(fields ...field.RelationField) ITeamCollectionDo + Preload(fields ...field.RelationField) ITeamCollectionDo + FirstOrInit() (*model.TeamCollection, error) + FirstOrCreate() (*model.TeamCollection, error) + FindByPage(offset int, limit int) (result []*model.TeamCollection, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamCollectionDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamCollectionDo) Debug() ITeamCollectionDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamCollectionDo) WithContext(ctx context.Context) ITeamCollectionDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamCollectionDo) ReadDB() ITeamCollectionDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamCollectionDo) WriteDB() ITeamCollectionDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamCollectionDo) Session(config *gorm.Session) ITeamCollectionDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamCollectionDo) Clauses(conds ...clause.Expression) ITeamCollectionDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamCollectionDo) Returning(value interface{}, columns ...string) ITeamCollectionDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamCollectionDo) Not(conds ...gen.Condition) ITeamCollectionDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamCollectionDo) Or(conds ...gen.Condition) ITeamCollectionDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamCollectionDo) Select(conds ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamCollectionDo) Where(conds ...gen.Condition) ITeamCollectionDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamCollectionDo) Order(conds ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamCollectionDo) Distinct(cols ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamCollectionDo) Omit(cols ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamCollectionDo) Join(table schema.Tabler, on ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamCollectionDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamCollectionDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamCollectionDo) Group(cols ...field.Expr) ITeamCollectionDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamCollectionDo) Having(conds ...gen.Condition) ITeamCollectionDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamCollectionDo) Limit(limit int) ITeamCollectionDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamCollectionDo) Offset(offset int) ITeamCollectionDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamCollectionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamCollectionDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamCollectionDo) Unscoped() ITeamCollectionDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamCollectionDo) Create(values ...*model.TeamCollection) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamCollectionDo) CreateInBatches(values []*model.TeamCollection, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamCollectionDo) Save(values ...*model.TeamCollection) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamCollectionDo) First() (*model.TeamCollection, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.TeamCollection), nil + } +} + +func (t teamCollectionDo) Take() (*model.TeamCollection, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.TeamCollection), nil + } +} + +func (t teamCollectionDo) Last() (*model.TeamCollection, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.TeamCollection), nil + } +} + +func (t teamCollectionDo) Find() ([]*model.TeamCollection, error) { + result, err := t.DO.Find() + return result.([]*model.TeamCollection), err +} + +func (t teamCollectionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamCollection, err error) { + buf := make([]*model.TeamCollection, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamCollectionDo) FindInBatches(result *[]*model.TeamCollection, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamCollectionDo) Attrs(attrs ...field.AssignExpr) ITeamCollectionDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamCollectionDo) Assign(attrs ...field.AssignExpr) ITeamCollectionDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamCollectionDo) Joins(fields ...field.RelationField) ITeamCollectionDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamCollectionDo) Preload(fields ...field.RelationField) ITeamCollectionDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamCollectionDo) FirstOrInit() (*model.TeamCollection, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.TeamCollection), nil + } +} + +func (t teamCollectionDo) FirstOrCreate() (*model.TeamCollection, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.TeamCollection), nil + } +} + +func (t teamCollectionDo) FindByPage(offset int, limit int) (result []*model.TeamCollection, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamCollectionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamCollectionDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamCollectionDo) Delete(models ...*model.TeamCollection) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamCollectionDo) withDO(do gen.Dao) *teamCollectionDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/teamcollection.gen_test.go b/pkg/models/teamcollection.gen_test.go new file mode 100644 index 0000000..7cc9a9f --- /dev/null +++ b/pkg/models/teamcollection.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.TeamCollection{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.TeamCollection{}) fail: %s", err) + } +} + +func Test_teamCollectionQuery(t *testing.T) { + teamCollection := newTeamCollection(db) + teamCollection = *teamCollection.As(teamCollection.TableName()) + _do := teamCollection.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(teamCollection.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := teamCollection.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from teamCollection success") + } + + err = _do.Create(&model.TeamCollection{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.TeamCollection{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.TeamCollection{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(teamCollection.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.TeamCollection{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(teamCollection.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(teamCollection.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.TeamCollection{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/teamenvironment.gen.go b/pkg/models/teamenvironment.gen.go new file mode 100644 index 0000000..4d0f031 --- /dev/null +++ b/pkg/models/teamenvironment.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeamEnvironment(db *gorm.DB, opts ...gen.DOOption) teamEnvironment { + _teamEnvironment := teamEnvironment{} + + _teamEnvironment.teamEnvironmentDo.UseDB(db, opts...) + _teamEnvironment.teamEnvironmentDo.UseModel(&model.TeamEnvironment{}) + + tableName := _teamEnvironment.teamEnvironmentDo.TableName() + _teamEnvironment.ALL = field.NewAsterisk(tableName) + _teamEnvironment.ID = field.NewString(tableName, "id") + _teamEnvironment.TeamID = field.NewString(tableName, "teamID") + _teamEnvironment.Name = field.NewString(tableName, "name") + _teamEnvironment.Variables = field.NewField(tableName, "variables") + + _teamEnvironment.fillFieldMap() + + return _teamEnvironment +} + +type teamEnvironment struct { + teamEnvironmentDo + + ALL field.Asterisk + ID field.String + TeamID field.String + Name field.String + Variables field.Field + + fieldMap map[string]field.Expr +} + +func (t teamEnvironment) Table(newTableName string) *teamEnvironment { + t.teamEnvironmentDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t teamEnvironment) As(alias string) *teamEnvironment { + t.teamEnvironmentDo.DO = *(t.teamEnvironmentDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *teamEnvironment) updateTableName(table string) *teamEnvironment { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.TeamID = field.NewString(table, "teamID") + t.Name = field.NewString(table, "name") + t.Variables = field.NewField(table, "variables") + + t.fillFieldMap() + + return t +} + +func (t *teamEnvironment) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *teamEnvironment) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 4) + t.fieldMap["id"] = t.ID + t.fieldMap["teamID"] = t.TeamID + t.fieldMap["name"] = t.Name + t.fieldMap["variables"] = t.Variables +} + +func (t teamEnvironment) clone(db *gorm.DB) teamEnvironment { + t.teamEnvironmentDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t teamEnvironment) replaceDB(db *gorm.DB) teamEnvironment { + t.teamEnvironmentDo.ReplaceDB(db) + return t +} + +type teamEnvironmentDo struct{ gen.DO } + +type ITeamEnvironmentDo interface { + gen.SubQuery + Debug() ITeamEnvironmentDo + WithContext(ctx context.Context) ITeamEnvironmentDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamEnvironmentDo + WriteDB() ITeamEnvironmentDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamEnvironmentDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamEnvironmentDo + Not(conds ...gen.Condition) ITeamEnvironmentDo + Or(conds ...gen.Condition) ITeamEnvironmentDo + Select(conds ...field.Expr) ITeamEnvironmentDo + Where(conds ...gen.Condition) ITeamEnvironmentDo + Order(conds ...field.Expr) ITeamEnvironmentDo + Distinct(cols ...field.Expr) ITeamEnvironmentDo + Omit(cols ...field.Expr) ITeamEnvironmentDo + Join(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo + Group(cols ...field.Expr) ITeamEnvironmentDo + Having(conds ...gen.Condition) ITeamEnvironmentDo + Limit(limit int) ITeamEnvironmentDo + Offset(offset int) ITeamEnvironmentDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamEnvironmentDo + Unscoped() ITeamEnvironmentDo + Create(values ...*model.TeamEnvironment) error + CreateInBatches(values []*model.TeamEnvironment, batchSize int) error + Save(values ...*model.TeamEnvironment) error + First() (*model.TeamEnvironment, error) + Take() (*model.TeamEnvironment, error) + Last() (*model.TeamEnvironment, error) + Find() ([]*model.TeamEnvironment, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamEnvironment, err error) + FindInBatches(result *[]*model.TeamEnvironment, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.TeamEnvironment) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamEnvironmentDo + Assign(attrs ...field.AssignExpr) ITeamEnvironmentDo + Joins(fields ...field.RelationField) ITeamEnvironmentDo + Preload(fields ...field.RelationField) ITeamEnvironmentDo + FirstOrInit() (*model.TeamEnvironment, error) + FirstOrCreate() (*model.TeamEnvironment, error) + FindByPage(offset int, limit int) (result []*model.TeamEnvironment, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamEnvironmentDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamEnvironmentDo) Debug() ITeamEnvironmentDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamEnvironmentDo) WithContext(ctx context.Context) ITeamEnvironmentDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamEnvironmentDo) ReadDB() ITeamEnvironmentDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamEnvironmentDo) WriteDB() ITeamEnvironmentDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamEnvironmentDo) Session(config *gorm.Session) ITeamEnvironmentDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamEnvironmentDo) Clauses(conds ...clause.Expression) ITeamEnvironmentDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamEnvironmentDo) Returning(value interface{}, columns ...string) ITeamEnvironmentDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamEnvironmentDo) Not(conds ...gen.Condition) ITeamEnvironmentDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamEnvironmentDo) Or(conds ...gen.Condition) ITeamEnvironmentDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamEnvironmentDo) Select(conds ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamEnvironmentDo) Where(conds ...gen.Condition) ITeamEnvironmentDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamEnvironmentDo) Order(conds ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamEnvironmentDo) Distinct(cols ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamEnvironmentDo) Omit(cols ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamEnvironmentDo) Join(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamEnvironmentDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamEnvironmentDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamEnvironmentDo) Group(cols ...field.Expr) ITeamEnvironmentDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamEnvironmentDo) Having(conds ...gen.Condition) ITeamEnvironmentDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamEnvironmentDo) Limit(limit int) ITeamEnvironmentDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamEnvironmentDo) Offset(offset int) ITeamEnvironmentDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamEnvironmentDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamEnvironmentDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamEnvironmentDo) Unscoped() ITeamEnvironmentDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamEnvironmentDo) Create(values ...*model.TeamEnvironment) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamEnvironmentDo) CreateInBatches(values []*model.TeamEnvironment, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamEnvironmentDo) Save(values ...*model.TeamEnvironment) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamEnvironmentDo) First() (*model.TeamEnvironment, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.TeamEnvironment), nil + } +} + +func (t teamEnvironmentDo) Take() (*model.TeamEnvironment, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.TeamEnvironment), nil + } +} + +func (t teamEnvironmentDo) Last() (*model.TeamEnvironment, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.TeamEnvironment), nil + } +} + +func (t teamEnvironmentDo) Find() ([]*model.TeamEnvironment, error) { + result, err := t.DO.Find() + return result.([]*model.TeamEnvironment), err +} + +func (t teamEnvironmentDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamEnvironment, err error) { + buf := make([]*model.TeamEnvironment, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamEnvironmentDo) FindInBatches(result *[]*model.TeamEnvironment, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamEnvironmentDo) Attrs(attrs ...field.AssignExpr) ITeamEnvironmentDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamEnvironmentDo) Assign(attrs ...field.AssignExpr) ITeamEnvironmentDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamEnvironmentDo) Joins(fields ...field.RelationField) ITeamEnvironmentDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamEnvironmentDo) Preload(fields ...field.RelationField) ITeamEnvironmentDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamEnvironmentDo) FirstOrInit() (*model.TeamEnvironment, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.TeamEnvironment), nil + } +} + +func (t teamEnvironmentDo) FirstOrCreate() (*model.TeamEnvironment, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.TeamEnvironment), nil + } +} + +func (t teamEnvironmentDo) FindByPage(offset int, limit int) (result []*model.TeamEnvironment, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamEnvironmentDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamEnvironmentDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamEnvironmentDo) Delete(models ...*model.TeamEnvironment) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamEnvironmentDo) withDO(do gen.Dao) *teamEnvironmentDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/teamenvironment.gen_test.go b/pkg/models/teamenvironment.gen_test.go new file mode 100644 index 0000000..79b5aeb --- /dev/null +++ b/pkg/models/teamenvironment.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.TeamEnvironment{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.TeamEnvironment{}) fail: %s", err) + } +} + +func Test_teamEnvironmentQuery(t *testing.T) { + teamEnvironment := newTeamEnvironment(db) + teamEnvironment = *teamEnvironment.As(teamEnvironment.TableName()) + _do := teamEnvironment.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(teamEnvironment.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := teamEnvironment.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from teamEnvironment success") + } + + err = _do.Create(&model.TeamEnvironment{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.TeamEnvironment{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.TeamEnvironment{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(teamEnvironment.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.TeamEnvironment{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(teamEnvironment.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(teamEnvironment.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.TeamEnvironment{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/teaminvitation.gen.go b/pkg/models/teaminvitation.gen.go new file mode 100644 index 0000000..53305c1 --- /dev/null +++ b/pkg/models/teaminvitation.gen.go @@ -0,0 +1,396 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeamInvitation(db *gorm.DB, opts ...gen.DOOption) teamInvitation { + _teamInvitation := teamInvitation{} + + _teamInvitation.teamInvitationDo.UseDB(db, opts...) + _teamInvitation.teamInvitationDo.UseModel(&model.TeamInvitation{}) + + tableName := _teamInvitation.teamInvitationDo.TableName() + _teamInvitation.ALL = field.NewAsterisk(tableName) + _teamInvitation.ID = field.NewString(tableName, "id") + _teamInvitation.TeamID = field.NewString(tableName, "teamID") + _teamInvitation.CreatorUID = field.NewString(tableName, "creatorUid") + _teamInvitation.InviteeEmail = field.NewString(tableName, "inviteeEmail") + _teamInvitation.InviteeRole = field.NewField(tableName, "inviteeRole") + + _teamInvitation.fillFieldMap() + + return _teamInvitation +} + +type teamInvitation struct { + teamInvitationDo + + ALL field.Asterisk + ID field.String + TeamID field.String + CreatorUID field.String + InviteeEmail field.String + InviteeRole field.Field + + fieldMap map[string]field.Expr +} + +func (t teamInvitation) Table(newTableName string) *teamInvitation { + t.teamInvitationDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t teamInvitation) As(alias string) *teamInvitation { + t.teamInvitationDo.DO = *(t.teamInvitationDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *teamInvitation) updateTableName(table string) *teamInvitation { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.TeamID = field.NewString(table, "teamID") + t.CreatorUID = field.NewString(table, "creatorUid") + t.InviteeEmail = field.NewString(table, "inviteeEmail") + t.InviteeRole = field.NewField(table, "inviteeRole") + + t.fillFieldMap() + + return t +} + +func (t *teamInvitation) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *teamInvitation) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 5) + t.fieldMap["id"] = t.ID + t.fieldMap["teamID"] = t.TeamID + t.fieldMap["creatorUid"] = t.CreatorUID + t.fieldMap["inviteeEmail"] = t.InviteeEmail + t.fieldMap["inviteeRole"] = t.InviteeRole +} + +func (t teamInvitation) clone(db *gorm.DB) teamInvitation { + t.teamInvitationDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t teamInvitation) replaceDB(db *gorm.DB) teamInvitation { + t.teamInvitationDo.ReplaceDB(db) + return t +} + +type teamInvitationDo struct{ gen.DO } + +type ITeamInvitationDo interface { + gen.SubQuery + Debug() ITeamInvitationDo + WithContext(ctx context.Context) ITeamInvitationDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamInvitationDo + WriteDB() ITeamInvitationDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamInvitationDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamInvitationDo + Not(conds ...gen.Condition) ITeamInvitationDo + Or(conds ...gen.Condition) ITeamInvitationDo + Select(conds ...field.Expr) ITeamInvitationDo + Where(conds ...gen.Condition) ITeamInvitationDo + Order(conds ...field.Expr) ITeamInvitationDo + Distinct(cols ...field.Expr) ITeamInvitationDo + Omit(cols ...field.Expr) ITeamInvitationDo + Join(table schema.Tabler, on ...field.Expr) ITeamInvitationDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamInvitationDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamInvitationDo + Group(cols ...field.Expr) ITeamInvitationDo + Having(conds ...gen.Condition) ITeamInvitationDo + Limit(limit int) ITeamInvitationDo + Offset(offset int) ITeamInvitationDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamInvitationDo + Unscoped() ITeamInvitationDo + Create(values ...*model.TeamInvitation) error + CreateInBatches(values []*model.TeamInvitation, batchSize int) error + Save(values ...*model.TeamInvitation) error + First() (*model.TeamInvitation, error) + Take() (*model.TeamInvitation, error) + Last() (*model.TeamInvitation, error) + Find() ([]*model.TeamInvitation, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamInvitation, err error) + FindInBatches(result *[]*model.TeamInvitation, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.TeamInvitation) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamInvitationDo + Assign(attrs ...field.AssignExpr) ITeamInvitationDo + Joins(fields ...field.RelationField) ITeamInvitationDo + Preload(fields ...field.RelationField) ITeamInvitationDo + FirstOrInit() (*model.TeamInvitation, error) + FirstOrCreate() (*model.TeamInvitation, error) + FindByPage(offset int, limit int) (result []*model.TeamInvitation, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamInvitationDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamInvitationDo) Debug() ITeamInvitationDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamInvitationDo) WithContext(ctx context.Context) ITeamInvitationDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamInvitationDo) ReadDB() ITeamInvitationDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamInvitationDo) WriteDB() ITeamInvitationDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamInvitationDo) Session(config *gorm.Session) ITeamInvitationDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamInvitationDo) Clauses(conds ...clause.Expression) ITeamInvitationDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamInvitationDo) Returning(value interface{}, columns ...string) ITeamInvitationDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamInvitationDo) Not(conds ...gen.Condition) ITeamInvitationDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamInvitationDo) Or(conds ...gen.Condition) ITeamInvitationDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamInvitationDo) Select(conds ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamInvitationDo) Where(conds ...gen.Condition) ITeamInvitationDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamInvitationDo) Order(conds ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamInvitationDo) Distinct(cols ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamInvitationDo) Omit(cols ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamInvitationDo) Join(table schema.Tabler, on ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamInvitationDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamInvitationDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamInvitationDo) Group(cols ...field.Expr) ITeamInvitationDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamInvitationDo) Having(conds ...gen.Condition) ITeamInvitationDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamInvitationDo) Limit(limit int) ITeamInvitationDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamInvitationDo) Offset(offset int) ITeamInvitationDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamInvitationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamInvitationDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamInvitationDo) Unscoped() ITeamInvitationDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamInvitationDo) Create(values ...*model.TeamInvitation) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamInvitationDo) CreateInBatches(values []*model.TeamInvitation, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamInvitationDo) Save(values ...*model.TeamInvitation) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamInvitationDo) First() (*model.TeamInvitation, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.TeamInvitation), nil + } +} + +func (t teamInvitationDo) Take() (*model.TeamInvitation, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.TeamInvitation), nil + } +} + +func (t teamInvitationDo) Last() (*model.TeamInvitation, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.TeamInvitation), nil + } +} + +func (t teamInvitationDo) Find() ([]*model.TeamInvitation, error) { + result, err := t.DO.Find() + return result.([]*model.TeamInvitation), err +} + +func (t teamInvitationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamInvitation, err error) { + buf := make([]*model.TeamInvitation, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamInvitationDo) FindInBatches(result *[]*model.TeamInvitation, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamInvitationDo) Attrs(attrs ...field.AssignExpr) ITeamInvitationDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamInvitationDo) Assign(attrs ...field.AssignExpr) ITeamInvitationDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamInvitationDo) Joins(fields ...field.RelationField) ITeamInvitationDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamInvitationDo) Preload(fields ...field.RelationField) ITeamInvitationDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamInvitationDo) FirstOrInit() (*model.TeamInvitation, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.TeamInvitation), nil + } +} + +func (t teamInvitationDo) FirstOrCreate() (*model.TeamInvitation, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.TeamInvitation), nil + } +} + +func (t teamInvitationDo) FindByPage(offset int, limit int) (result []*model.TeamInvitation, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamInvitationDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamInvitationDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamInvitationDo) Delete(models ...*model.TeamInvitation) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamInvitationDo) withDO(do gen.Dao) *teamInvitationDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/teaminvitation.gen_test.go b/pkg/models/teaminvitation.gen_test.go new file mode 100644 index 0000000..9233bfa --- /dev/null +++ b/pkg/models/teaminvitation.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.TeamInvitation{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.TeamInvitation{}) fail: %s", err) + } +} + +func Test_teamInvitationQuery(t *testing.T) { + teamInvitation := newTeamInvitation(db) + teamInvitation = *teamInvitation.As(teamInvitation.TableName()) + _do := teamInvitation.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(teamInvitation.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := teamInvitation.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from teamInvitation success") + } + + err = _do.Create(&model.TeamInvitation{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.TeamInvitation{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.TeamInvitation{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(teamInvitation.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.TeamInvitation{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(teamInvitation.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(teamInvitation.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.TeamInvitation{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/teammember.gen.go b/pkg/models/teammember.gen.go new file mode 100644 index 0000000..9ea81d6 --- /dev/null +++ b/pkg/models/teammember.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeamMember(db *gorm.DB, opts ...gen.DOOption) teamMember { + _teamMember := teamMember{} + + _teamMember.teamMemberDo.UseDB(db, opts...) + _teamMember.teamMemberDo.UseModel(&model.TeamMember{}) + + tableName := _teamMember.teamMemberDo.TableName() + _teamMember.ALL = field.NewAsterisk(tableName) + _teamMember.ID = field.NewString(tableName, "id") + _teamMember.Role = field.NewField(tableName, "role") + _teamMember.UserUID = field.NewString(tableName, "userUid") + _teamMember.TeamID = field.NewString(tableName, "teamID") + + _teamMember.fillFieldMap() + + return _teamMember +} + +type teamMember struct { + teamMemberDo + + ALL field.Asterisk + ID field.String + Role field.Field + UserUID field.String + TeamID field.String + + fieldMap map[string]field.Expr +} + +func (t teamMember) Table(newTableName string) *teamMember { + t.teamMemberDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t teamMember) As(alias string) *teamMember { + t.teamMemberDo.DO = *(t.teamMemberDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *teamMember) updateTableName(table string) *teamMember { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.Role = field.NewField(table, "role") + t.UserUID = field.NewString(table, "userUid") + t.TeamID = field.NewString(table, "teamID") + + t.fillFieldMap() + + return t +} + +func (t *teamMember) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *teamMember) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 4) + t.fieldMap["id"] = t.ID + t.fieldMap["role"] = t.Role + t.fieldMap["userUid"] = t.UserUID + t.fieldMap["teamID"] = t.TeamID +} + +func (t teamMember) clone(db *gorm.DB) teamMember { + t.teamMemberDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t teamMember) replaceDB(db *gorm.DB) teamMember { + t.teamMemberDo.ReplaceDB(db) + return t +} + +type teamMemberDo struct{ gen.DO } + +type ITeamMemberDo interface { + gen.SubQuery + Debug() ITeamMemberDo + WithContext(ctx context.Context) ITeamMemberDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamMemberDo + WriteDB() ITeamMemberDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamMemberDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamMemberDo + Not(conds ...gen.Condition) ITeamMemberDo + Or(conds ...gen.Condition) ITeamMemberDo + Select(conds ...field.Expr) ITeamMemberDo + Where(conds ...gen.Condition) ITeamMemberDo + Order(conds ...field.Expr) ITeamMemberDo + Distinct(cols ...field.Expr) ITeamMemberDo + Omit(cols ...field.Expr) ITeamMemberDo + Join(table schema.Tabler, on ...field.Expr) ITeamMemberDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamMemberDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamMemberDo + Group(cols ...field.Expr) ITeamMemberDo + Having(conds ...gen.Condition) ITeamMemberDo + Limit(limit int) ITeamMemberDo + Offset(offset int) ITeamMemberDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamMemberDo + Unscoped() ITeamMemberDo + Create(values ...*model.TeamMember) error + CreateInBatches(values []*model.TeamMember, batchSize int) error + Save(values ...*model.TeamMember) error + First() (*model.TeamMember, error) + Take() (*model.TeamMember, error) + Last() (*model.TeamMember, error) + Find() ([]*model.TeamMember, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamMember, err error) + FindInBatches(result *[]*model.TeamMember, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.TeamMember) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamMemberDo + Assign(attrs ...field.AssignExpr) ITeamMemberDo + Joins(fields ...field.RelationField) ITeamMemberDo + Preload(fields ...field.RelationField) ITeamMemberDo + FirstOrInit() (*model.TeamMember, error) + FirstOrCreate() (*model.TeamMember, error) + FindByPage(offset int, limit int) (result []*model.TeamMember, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamMemberDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamMemberDo) Debug() ITeamMemberDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamMemberDo) WithContext(ctx context.Context) ITeamMemberDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamMemberDo) ReadDB() ITeamMemberDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamMemberDo) WriteDB() ITeamMemberDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamMemberDo) Session(config *gorm.Session) ITeamMemberDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamMemberDo) Clauses(conds ...clause.Expression) ITeamMemberDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamMemberDo) Returning(value interface{}, columns ...string) ITeamMemberDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamMemberDo) Not(conds ...gen.Condition) ITeamMemberDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamMemberDo) Or(conds ...gen.Condition) ITeamMemberDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamMemberDo) Select(conds ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamMemberDo) Where(conds ...gen.Condition) ITeamMemberDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamMemberDo) Order(conds ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamMemberDo) Distinct(cols ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamMemberDo) Omit(cols ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamMemberDo) Join(table schema.Tabler, on ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamMemberDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamMemberDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamMemberDo) Group(cols ...field.Expr) ITeamMemberDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamMemberDo) Having(conds ...gen.Condition) ITeamMemberDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamMemberDo) Limit(limit int) ITeamMemberDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamMemberDo) Offset(offset int) ITeamMemberDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamMemberDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamMemberDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamMemberDo) Unscoped() ITeamMemberDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamMemberDo) Create(values ...*model.TeamMember) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamMemberDo) CreateInBatches(values []*model.TeamMember, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamMemberDo) Save(values ...*model.TeamMember) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamMemberDo) First() (*model.TeamMember, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.TeamMember), nil + } +} + +func (t teamMemberDo) Take() (*model.TeamMember, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.TeamMember), nil + } +} + +func (t teamMemberDo) Last() (*model.TeamMember, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.TeamMember), nil + } +} + +func (t teamMemberDo) Find() ([]*model.TeamMember, error) { + result, err := t.DO.Find() + return result.([]*model.TeamMember), err +} + +func (t teamMemberDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamMember, err error) { + buf := make([]*model.TeamMember, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamMemberDo) FindInBatches(result *[]*model.TeamMember, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamMemberDo) Attrs(attrs ...field.AssignExpr) ITeamMemberDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamMemberDo) Assign(attrs ...field.AssignExpr) ITeamMemberDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamMemberDo) Joins(fields ...field.RelationField) ITeamMemberDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamMemberDo) Preload(fields ...field.RelationField) ITeamMemberDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamMemberDo) FirstOrInit() (*model.TeamMember, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.TeamMember), nil + } +} + +func (t teamMemberDo) FirstOrCreate() (*model.TeamMember, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.TeamMember), nil + } +} + +func (t teamMemberDo) FindByPage(offset int, limit int) (result []*model.TeamMember, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamMemberDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamMemberDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamMemberDo) Delete(models ...*model.TeamMember) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamMemberDo) withDO(do gen.Dao) *teamMemberDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/teammember.gen_test.go b/pkg/models/teammember.gen_test.go new file mode 100644 index 0000000..cb6ee10 --- /dev/null +++ b/pkg/models/teammember.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.TeamMember{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.TeamMember{}) fail: %s", err) + } +} + +func Test_teamMemberQuery(t *testing.T) { + teamMember := newTeamMember(db) + teamMember = *teamMember.As(teamMember.TableName()) + _do := teamMember.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(teamMember.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := teamMember.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from teamMember success") + } + + err = _do.Create(&model.TeamMember{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.TeamMember{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.TeamMember{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(teamMember.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.TeamMember{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(teamMember.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(teamMember.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.TeamMember{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/teamrequest.gen.go b/pkg/models/teamrequest.gen.go new file mode 100644 index 0000000..c11c998 --- /dev/null +++ b/pkg/models/teamrequest.gen.go @@ -0,0 +1,408 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newTeamRequest(db *gorm.DB, opts ...gen.DOOption) teamRequest { + _teamRequest := teamRequest{} + + _teamRequest.teamRequestDo.UseDB(db, opts...) + _teamRequest.teamRequestDo.UseModel(&model.TeamRequest{}) + + tableName := _teamRequest.teamRequestDo.TableName() + _teamRequest.ALL = field.NewAsterisk(tableName) + _teamRequest.ID = field.NewString(tableName, "id") + _teamRequest.CollectionID = field.NewString(tableName, "collectionID") + _teamRequest.TeamID = field.NewString(tableName, "teamID") + _teamRequest.Title = field.NewString(tableName, "title") + _teamRequest.Request = field.NewField(tableName, "request") + _teamRequest.OrderIndex = field.NewInt32(tableName, "orderIndex") + _teamRequest.CreatedOn = field.NewTime(tableName, "createdOn") + _teamRequest.UpdatedOn = field.NewTime(tableName, "updatedOn") + + _teamRequest.fillFieldMap() + + return _teamRequest +} + +type teamRequest struct { + teamRequestDo + + ALL field.Asterisk + ID field.String + CollectionID field.String + TeamID field.String + Title field.String + Request field.Field + OrderIndex field.Int32 + CreatedOn field.Time + UpdatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (t teamRequest) Table(newTableName string) *teamRequest { + t.teamRequestDo.UseTable(newTableName) + return t.updateTableName(newTableName) +} + +func (t teamRequest) As(alias string) *teamRequest { + t.teamRequestDo.DO = *(t.teamRequestDo.As(alias).(*gen.DO)) + return t.updateTableName(alias) +} + +func (t *teamRequest) updateTableName(table string) *teamRequest { + t.ALL = field.NewAsterisk(table) + t.ID = field.NewString(table, "id") + t.CollectionID = field.NewString(table, "collectionID") + t.TeamID = field.NewString(table, "teamID") + t.Title = field.NewString(table, "title") + t.Request = field.NewField(table, "request") + t.OrderIndex = field.NewInt32(table, "orderIndex") + t.CreatedOn = field.NewTime(table, "createdOn") + t.UpdatedOn = field.NewTime(table, "updatedOn") + + t.fillFieldMap() + + return t +} + +func (t *teamRequest) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := t.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (t *teamRequest) fillFieldMap() { + t.fieldMap = make(map[string]field.Expr, 8) + t.fieldMap["id"] = t.ID + t.fieldMap["collectionID"] = t.CollectionID + t.fieldMap["teamID"] = t.TeamID + t.fieldMap["title"] = t.Title + t.fieldMap["request"] = t.Request + t.fieldMap["orderIndex"] = t.OrderIndex + t.fieldMap["createdOn"] = t.CreatedOn + t.fieldMap["updatedOn"] = t.UpdatedOn +} + +func (t teamRequest) clone(db *gorm.DB) teamRequest { + t.teamRequestDo.ReplaceConnPool(db.Statement.ConnPool) + return t +} + +func (t teamRequest) replaceDB(db *gorm.DB) teamRequest { + t.teamRequestDo.ReplaceDB(db) + return t +} + +type teamRequestDo struct{ gen.DO } + +type ITeamRequestDo interface { + gen.SubQuery + Debug() ITeamRequestDo + WithContext(ctx context.Context) ITeamRequestDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() ITeamRequestDo + WriteDB() ITeamRequestDo + As(alias string) gen.Dao + Session(config *gorm.Session) ITeamRequestDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) ITeamRequestDo + Not(conds ...gen.Condition) ITeamRequestDo + Or(conds ...gen.Condition) ITeamRequestDo + Select(conds ...field.Expr) ITeamRequestDo + Where(conds ...gen.Condition) ITeamRequestDo + Order(conds ...field.Expr) ITeamRequestDo + Distinct(cols ...field.Expr) ITeamRequestDo + Omit(cols ...field.Expr) ITeamRequestDo + Join(table schema.Tabler, on ...field.Expr) ITeamRequestDo + LeftJoin(table schema.Tabler, on ...field.Expr) ITeamRequestDo + RightJoin(table schema.Tabler, on ...field.Expr) ITeamRequestDo + Group(cols ...field.Expr) ITeamRequestDo + Having(conds ...gen.Condition) ITeamRequestDo + Limit(limit int) ITeamRequestDo + Offset(offset int) ITeamRequestDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamRequestDo + Unscoped() ITeamRequestDo + Create(values ...*model.TeamRequest) error + CreateInBatches(values []*model.TeamRequest, batchSize int) error + Save(values ...*model.TeamRequest) error + First() (*model.TeamRequest, error) + Take() (*model.TeamRequest, error) + Last() (*model.TeamRequest, error) + Find() ([]*model.TeamRequest, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamRequest, err error) + FindInBatches(result *[]*model.TeamRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.TeamRequest) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) ITeamRequestDo + Assign(attrs ...field.AssignExpr) ITeamRequestDo + Joins(fields ...field.RelationField) ITeamRequestDo + Preload(fields ...field.RelationField) ITeamRequestDo + FirstOrInit() (*model.TeamRequest, error) + FirstOrCreate() (*model.TeamRequest, error) + FindByPage(offset int, limit int) (result []*model.TeamRequest, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) ITeamRequestDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (t teamRequestDo) Debug() ITeamRequestDo { + return t.withDO(t.DO.Debug()) +} + +func (t teamRequestDo) WithContext(ctx context.Context) ITeamRequestDo { + return t.withDO(t.DO.WithContext(ctx)) +} + +func (t teamRequestDo) ReadDB() ITeamRequestDo { + return t.Clauses(dbresolver.Read) +} + +func (t teamRequestDo) WriteDB() ITeamRequestDo { + return t.Clauses(dbresolver.Write) +} + +func (t teamRequestDo) Session(config *gorm.Session) ITeamRequestDo { + return t.withDO(t.DO.Session(config)) +} + +func (t teamRequestDo) Clauses(conds ...clause.Expression) ITeamRequestDo { + return t.withDO(t.DO.Clauses(conds...)) +} + +func (t teamRequestDo) Returning(value interface{}, columns ...string) ITeamRequestDo { + return t.withDO(t.DO.Returning(value, columns...)) +} + +func (t teamRequestDo) Not(conds ...gen.Condition) ITeamRequestDo { + return t.withDO(t.DO.Not(conds...)) +} + +func (t teamRequestDo) Or(conds ...gen.Condition) ITeamRequestDo { + return t.withDO(t.DO.Or(conds...)) +} + +func (t teamRequestDo) Select(conds ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Select(conds...)) +} + +func (t teamRequestDo) Where(conds ...gen.Condition) ITeamRequestDo { + return t.withDO(t.DO.Where(conds...)) +} + +func (t teamRequestDo) Order(conds ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Order(conds...)) +} + +func (t teamRequestDo) Distinct(cols ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Distinct(cols...)) +} + +func (t teamRequestDo) Omit(cols ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Omit(cols...)) +} + +func (t teamRequestDo) Join(table schema.Tabler, on ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Join(table, on...)) +} + +func (t teamRequestDo) LeftJoin(table schema.Tabler, on ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.LeftJoin(table, on...)) +} + +func (t teamRequestDo) RightJoin(table schema.Tabler, on ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.RightJoin(table, on...)) +} + +func (t teamRequestDo) Group(cols ...field.Expr) ITeamRequestDo { + return t.withDO(t.DO.Group(cols...)) +} + +func (t teamRequestDo) Having(conds ...gen.Condition) ITeamRequestDo { + return t.withDO(t.DO.Having(conds...)) +} + +func (t teamRequestDo) Limit(limit int) ITeamRequestDo { + return t.withDO(t.DO.Limit(limit)) +} + +func (t teamRequestDo) Offset(offset int) ITeamRequestDo { + return t.withDO(t.DO.Offset(offset)) +} + +func (t teamRequestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) ITeamRequestDo { + return t.withDO(t.DO.Scopes(funcs...)) +} + +func (t teamRequestDo) Unscoped() ITeamRequestDo { + return t.withDO(t.DO.Unscoped()) +} + +func (t teamRequestDo) Create(values ...*model.TeamRequest) error { + if len(values) == 0 { + return nil + } + return t.DO.Create(values) +} + +func (t teamRequestDo) CreateInBatches(values []*model.TeamRequest, batchSize int) error { + return t.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (t teamRequestDo) Save(values ...*model.TeamRequest) error { + if len(values) == 0 { + return nil + } + return t.DO.Save(values) +} + +func (t teamRequestDo) First() (*model.TeamRequest, error) { + if result, err := t.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.TeamRequest), nil + } +} + +func (t teamRequestDo) Take() (*model.TeamRequest, error) { + if result, err := t.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.TeamRequest), nil + } +} + +func (t teamRequestDo) Last() (*model.TeamRequest, error) { + if result, err := t.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.TeamRequest), nil + } +} + +func (t teamRequestDo) Find() ([]*model.TeamRequest, error) { + result, err := t.DO.Find() + return result.([]*model.TeamRequest), err +} + +func (t teamRequestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.TeamRequest, err error) { + buf := make([]*model.TeamRequest, 0, batchSize) + err = t.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (t teamRequestDo) FindInBatches(result *[]*model.TeamRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return t.DO.FindInBatches(result, batchSize, fc) +} + +func (t teamRequestDo) Attrs(attrs ...field.AssignExpr) ITeamRequestDo { + return t.withDO(t.DO.Attrs(attrs...)) +} + +func (t teamRequestDo) Assign(attrs ...field.AssignExpr) ITeamRequestDo { + return t.withDO(t.DO.Assign(attrs...)) +} + +func (t teamRequestDo) Joins(fields ...field.RelationField) ITeamRequestDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Joins(_f)) + } + return &t +} + +func (t teamRequestDo) Preload(fields ...field.RelationField) ITeamRequestDo { + for _, _f := range fields { + t = *t.withDO(t.DO.Preload(_f)) + } + return &t +} + +func (t teamRequestDo) FirstOrInit() (*model.TeamRequest, error) { + if result, err := t.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.TeamRequest), nil + } +} + +func (t teamRequestDo) FirstOrCreate() (*model.TeamRequest, error) { + if result, err := t.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.TeamRequest), nil + } +} + +func (t teamRequestDo) FindByPage(offset int, limit int) (result []*model.TeamRequest, count int64, err error) { + result, err = t.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = t.Offset(-1).Limit(-1).Count() + return +} + +func (t teamRequestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = t.Count() + if err != nil { + return + } + + err = t.Offset(offset).Limit(limit).Scan(result) + return +} + +func (t teamRequestDo) Scan(result interface{}) (err error) { + return t.DO.Scan(result) +} + +func (t teamRequestDo) Delete(models ...*model.TeamRequest) (result gen.ResultInfo, err error) { + return t.DO.Delete(models) +} + +func (t *teamRequestDo) withDO(do gen.Dao) *teamRequestDo { + t.DO = *do.(*gen.DO) + return t +} diff --git a/pkg/models/teamrequest.gen_test.go b/pkg/models/teamrequest.gen_test.go new file mode 100644 index 0000000..2c0efe0 --- /dev/null +++ b/pkg/models/teamrequest.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.TeamRequest{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.TeamRequest{}) fail: %s", err) + } +} + +func Test_teamRequestQuery(t *testing.T) { + teamRequest := newTeamRequest(db) + teamRequest = *teamRequest.As(teamRequest.TableName()) + _do := teamRequest.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(teamRequest.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := teamRequest.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from teamRequest success") + } + + err = _do.Create(&model.TeamRequest{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.TeamRequest{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.TeamRequest{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(teamRequest.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.TeamRequest{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(teamRequest.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(teamRequest.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.TeamRequest{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/user.gen.go b/pkg/models/user.gen.go new file mode 100644 index 0000000..1b8e0a0 --- /dev/null +++ b/pkg/models/user.gen.go @@ -0,0 +1,412 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUser(db *gorm.DB, opts ...gen.DOOption) user { + _user := user{} + + _user.userDo.UseDB(db, opts...) + _user.userDo.UseModel(&model.User{}) + + tableName := _user.userDo.TableName() + _user.ALL = field.NewAsterisk(tableName) + _user.UID = field.NewString(tableName, "uid") + _user.DisplayName = field.NewString(tableName, "displayName") + _user.Email = field.NewString(tableName, "email") + _user.PhotoURL = field.NewString(tableName, "photoURL") + _user.IsAdmin = field.NewBool(tableName, "isAdmin") + _user.RefreshToken = field.NewString(tableName, "refreshToken") + _user.CurrentRESTSession = field.NewField(tableName, "currentRESTSession") + _user.CurrentGQLSession = field.NewField(tableName, "currentGQLSession") + _user.CreatedOn = field.NewTime(tableName, "createdOn") + + _user.fillFieldMap() + + return _user +} + +type user struct { + userDo + + ALL field.Asterisk + UID field.String + DisplayName field.String + Email field.String + PhotoURL field.String + IsAdmin field.Bool + RefreshToken field.String + CurrentRESTSession field.Field + CurrentGQLSession field.Field + CreatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (u user) Table(newTableName string) *user { + u.userDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u user) As(alias string) *user { + u.userDo.DO = *(u.userDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *user) updateTableName(table string) *user { + u.ALL = field.NewAsterisk(table) + u.UID = field.NewString(table, "uid") + u.DisplayName = field.NewString(table, "displayName") + u.Email = field.NewString(table, "email") + u.PhotoURL = field.NewString(table, "photoURL") + u.IsAdmin = field.NewBool(table, "isAdmin") + u.RefreshToken = field.NewString(table, "refreshToken") + u.CurrentRESTSession = field.NewField(table, "currentRESTSession") + u.CurrentGQLSession = field.NewField(table, "currentGQLSession") + u.CreatedOn = field.NewTime(table, "createdOn") + + u.fillFieldMap() + + return u +} + +func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *user) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 9) + u.fieldMap["uid"] = u.UID + u.fieldMap["displayName"] = u.DisplayName + u.fieldMap["email"] = u.Email + u.fieldMap["photoURL"] = u.PhotoURL + u.fieldMap["isAdmin"] = u.IsAdmin + u.fieldMap["refreshToken"] = u.RefreshToken + u.fieldMap["currentRESTSession"] = u.CurrentRESTSession + u.fieldMap["currentGQLSession"] = u.CurrentGQLSession + u.fieldMap["createdOn"] = u.CreatedOn +} + +func (u user) clone(db *gorm.DB) user { + u.userDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u user) replaceDB(db *gorm.DB) user { + u.userDo.ReplaceDB(db) + return u +} + +type userDo struct{ gen.DO } + +type IUserDo interface { + gen.SubQuery + Debug() IUserDo + WithContext(ctx context.Context) IUserDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserDo + WriteDB() IUserDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserDo + Not(conds ...gen.Condition) IUserDo + Or(conds ...gen.Condition) IUserDo + Select(conds ...field.Expr) IUserDo + Where(conds ...gen.Condition) IUserDo + Order(conds ...field.Expr) IUserDo + Distinct(cols ...field.Expr) IUserDo + Omit(cols ...field.Expr) IUserDo + Join(table schema.Tabler, on ...field.Expr) IUserDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserDo + Group(cols ...field.Expr) IUserDo + Having(conds ...gen.Condition) IUserDo + Limit(limit int) IUserDo + Offset(offset int) IUserDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserDo + Unscoped() IUserDo + Create(values ...*model.User) error + CreateInBatches(values []*model.User, batchSize int) error + Save(values ...*model.User) error + First() (*model.User, error) + Take() (*model.User, error) + Last() (*model.User, error) + Find() ([]*model.User, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) + FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.User) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserDo + Assign(attrs ...field.AssignExpr) IUserDo + Joins(fields ...field.RelationField) IUserDo + Preload(fields ...field.RelationField) IUserDo + FirstOrInit() (*model.User, error) + FirstOrCreate() (*model.User, error) + FindByPage(offset int, limit int) (result []*model.User, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userDo) Debug() IUserDo { + return u.withDO(u.DO.Debug()) +} + +func (u userDo) WithContext(ctx context.Context) IUserDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userDo) ReadDB() IUserDo { + return u.Clauses(dbresolver.Read) +} + +func (u userDo) WriteDB() IUserDo { + return u.Clauses(dbresolver.Write) +} + +func (u userDo) Session(config *gorm.Session) IUserDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userDo) Clauses(conds ...clause.Expression) IUserDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userDo) Returning(value interface{}, columns ...string) IUserDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userDo) Not(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userDo) Or(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userDo) Select(conds ...field.Expr) IUserDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userDo) Where(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userDo) Order(conds ...field.Expr) IUserDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userDo) Distinct(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userDo) Omit(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userDo) Join(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userDo) Group(cols ...field.Expr) IUserDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userDo) Having(conds ...gen.Condition) IUserDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userDo) Limit(limit int) IUserDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userDo) Offset(offset int) IUserDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userDo) Unscoped() IUserDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userDo) Create(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userDo) CreateInBatches(values []*model.User, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userDo) Save(values ...*model.User) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userDo) First() (*model.User, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Take() (*model.User, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Last() (*model.User, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) Find() ([]*model.User, error) { + result, err := u.DO.Find() + return result.([]*model.User), err +} + +func (u userDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) { + buf := make([]*model.User, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userDo) FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userDo) Attrs(attrs ...field.AssignExpr) IUserDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userDo) Assign(attrs ...field.AssignExpr) IUserDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userDo) Joins(fields ...field.RelationField) IUserDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userDo) Preload(fields ...field.RelationField) IUserDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userDo) FirstOrInit() (*model.User, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FirstOrCreate() (*model.User, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.User), nil + } +} + +func (u userDo) FindByPage(offset int, limit int) (result []*model.User, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userDo) Delete(models ...*model.User) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userDo) withDO(do gen.Dao) *userDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/user.gen_test.go b/pkg/models/user.gen_test.go new file mode 100644 index 0000000..352b4ba --- /dev/null +++ b/pkg/models/user.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.User{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.User{}) fail: %s", err) + } +} + +func Test_userQuery(t *testing.T) { + user := newUser(db) + user = *user.As(user.TableName()) + _do := user.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(user.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := user.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from user success") + } + + err = _do.Create(&model.User{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.User{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.User{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(user.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.User{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(user.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(user.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.User{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/usercollection.gen.go b/pkg/models/usercollection.gen.go new file mode 100644 index 0000000..82149fd --- /dev/null +++ b/pkg/models/usercollection.gen.go @@ -0,0 +1,412 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUserCollection(db *gorm.DB, opts ...gen.DOOption) userCollection { + _userCollection := userCollection{} + + _userCollection.userCollectionDo.UseDB(db, opts...) + _userCollection.userCollectionDo.UseModel(&model.UserCollection{}) + + tableName := _userCollection.userCollectionDo.TableName() + _userCollection.ALL = field.NewAsterisk(tableName) + _userCollection.ID = field.NewString(tableName, "id") + _userCollection.ParentID = field.NewString(tableName, "parentID") + _userCollection.UserUID = field.NewString(tableName, "userUid") + _userCollection.Title = field.NewString(tableName, "title") + _userCollection.OrderIndex = field.NewInt32(tableName, "orderIndex") + _userCollection.Type = field.NewField(tableName, "type") + _userCollection.CreatedOn = field.NewTime(tableName, "createdOn") + _userCollection.UpdatedOn = field.NewTime(tableName, "updatedOn") + _userCollection.Data = field.NewField(tableName, "data") + + _userCollection.fillFieldMap() + + return _userCollection +} + +type userCollection struct { + userCollectionDo + + ALL field.Asterisk + ID field.String + ParentID field.String + UserUID field.String + Title field.String + OrderIndex field.Int32 + Type field.Field + CreatedOn field.Time + UpdatedOn field.Time + Data field.Field + + fieldMap map[string]field.Expr +} + +func (u userCollection) Table(newTableName string) *userCollection { + u.userCollectionDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u userCollection) As(alias string) *userCollection { + u.userCollectionDo.DO = *(u.userCollectionDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *userCollection) updateTableName(table string) *userCollection { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewString(table, "id") + u.ParentID = field.NewString(table, "parentID") + u.UserUID = field.NewString(table, "userUid") + u.Title = field.NewString(table, "title") + u.OrderIndex = field.NewInt32(table, "orderIndex") + u.Type = field.NewField(table, "type") + u.CreatedOn = field.NewTime(table, "createdOn") + u.UpdatedOn = field.NewTime(table, "updatedOn") + u.Data = field.NewField(table, "data") + + u.fillFieldMap() + + return u +} + +func (u *userCollection) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *userCollection) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 9) + u.fieldMap["id"] = u.ID + u.fieldMap["parentID"] = u.ParentID + u.fieldMap["userUid"] = u.UserUID + u.fieldMap["title"] = u.Title + u.fieldMap["orderIndex"] = u.OrderIndex + u.fieldMap["type"] = u.Type + u.fieldMap["createdOn"] = u.CreatedOn + u.fieldMap["updatedOn"] = u.UpdatedOn + u.fieldMap["data"] = u.Data +} + +func (u userCollection) clone(db *gorm.DB) userCollection { + u.userCollectionDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u userCollection) replaceDB(db *gorm.DB) userCollection { + u.userCollectionDo.ReplaceDB(db) + return u +} + +type userCollectionDo struct{ gen.DO } + +type IUserCollectionDo interface { + gen.SubQuery + Debug() IUserCollectionDo + WithContext(ctx context.Context) IUserCollectionDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserCollectionDo + WriteDB() IUserCollectionDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserCollectionDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserCollectionDo + Not(conds ...gen.Condition) IUserCollectionDo + Or(conds ...gen.Condition) IUserCollectionDo + Select(conds ...field.Expr) IUserCollectionDo + Where(conds ...gen.Condition) IUserCollectionDo + Order(conds ...field.Expr) IUserCollectionDo + Distinct(cols ...field.Expr) IUserCollectionDo + Omit(cols ...field.Expr) IUserCollectionDo + Join(table schema.Tabler, on ...field.Expr) IUserCollectionDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserCollectionDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserCollectionDo + Group(cols ...field.Expr) IUserCollectionDo + Having(conds ...gen.Condition) IUserCollectionDo + Limit(limit int) IUserCollectionDo + Offset(offset int) IUserCollectionDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserCollectionDo + Unscoped() IUserCollectionDo + Create(values ...*model.UserCollection) error + CreateInBatches(values []*model.UserCollection, batchSize int) error + Save(values ...*model.UserCollection) error + First() (*model.UserCollection, error) + Take() (*model.UserCollection, error) + Last() (*model.UserCollection, error) + Find() ([]*model.UserCollection, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserCollection, err error) + FindInBatches(result *[]*model.UserCollection, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.UserCollection) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserCollectionDo + Assign(attrs ...field.AssignExpr) IUserCollectionDo + Joins(fields ...field.RelationField) IUserCollectionDo + Preload(fields ...field.RelationField) IUserCollectionDo + FirstOrInit() (*model.UserCollection, error) + FirstOrCreate() (*model.UserCollection, error) + FindByPage(offset int, limit int) (result []*model.UserCollection, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserCollectionDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userCollectionDo) Debug() IUserCollectionDo { + return u.withDO(u.DO.Debug()) +} + +func (u userCollectionDo) WithContext(ctx context.Context) IUserCollectionDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userCollectionDo) ReadDB() IUserCollectionDo { + return u.Clauses(dbresolver.Read) +} + +func (u userCollectionDo) WriteDB() IUserCollectionDo { + return u.Clauses(dbresolver.Write) +} + +func (u userCollectionDo) Session(config *gorm.Session) IUserCollectionDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userCollectionDo) Clauses(conds ...clause.Expression) IUserCollectionDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userCollectionDo) Returning(value interface{}, columns ...string) IUserCollectionDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userCollectionDo) Not(conds ...gen.Condition) IUserCollectionDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userCollectionDo) Or(conds ...gen.Condition) IUserCollectionDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userCollectionDo) Select(conds ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userCollectionDo) Where(conds ...gen.Condition) IUserCollectionDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userCollectionDo) Order(conds ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userCollectionDo) Distinct(cols ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userCollectionDo) Omit(cols ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userCollectionDo) Join(table schema.Tabler, on ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userCollectionDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userCollectionDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userCollectionDo) Group(cols ...field.Expr) IUserCollectionDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userCollectionDo) Having(conds ...gen.Condition) IUserCollectionDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userCollectionDo) Limit(limit int) IUserCollectionDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userCollectionDo) Offset(offset int) IUserCollectionDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userCollectionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserCollectionDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userCollectionDo) Unscoped() IUserCollectionDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userCollectionDo) Create(values ...*model.UserCollection) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userCollectionDo) CreateInBatches(values []*model.UserCollection, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userCollectionDo) Save(values ...*model.UserCollection) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userCollectionDo) First() (*model.UserCollection, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.UserCollection), nil + } +} + +func (u userCollectionDo) Take() (*model.UserCollection, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.UserCollection), nil + } +} + +func (u userCollectionDo) Last() (*model.UserCollection, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.UserCollection), nil + } +} + +func (u userCollectionDo) Find() ([]*model.UserCollection, error) { + result, err := u.DO.Find() + return result.([]*model.UserCollection), err +} + +func (u userCollectionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserCollection, err error) { + buf := make([]*model.UserCollection, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userCollectionDo) FindInBatches(result *[]*model.UserCollection, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userCollectionDo) Attrs(attrs ...field.AssignExpr) IUserCollectionDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userCollectionDo) Assign(attrs ...field.AssignExpr) IUserCollectionDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userCollectionDo) Joins(fields ...field.RelationField) IUserCollectionDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userCollectionDo) Preload(fields ...field.RelationField) IUserCollectionDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userCollectionDo) FirstOrInit() (*model.UserCollection, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.UserCollection), nil + } +} + +func (u userCollectionDo) FirstOrCreate() (*model.UserCollection, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.UserCollection), nil + } +} + +func (u userCollectionDo) FindByPage(offset int, limit int) (result []*model.UserCollection, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userCollectionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userCollectionDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userCollectionDo) Delete(models ...*model.UserCollection) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userCollectionDo) withDO(do gen.Dao) *userCollectionDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/usercollection.gen_test.go b/pkg/models/usercollection.gen_test.go new file mode 100644 index 0000000..d50bce2 --- /dev/null +++ b/pkg/models/usercollection.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.UserCollection{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.UserCollection{}) fail: %s", err) + } +} + +func Test_userCollectionQuery(t *testing.T) { + userCollection := newUserCollection(db) + userCollection = *userCollection.As(userCollection.TableName()) + _do := userCollection.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(userCollection.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := userCollection.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from userCollection success") + } + + err = _do.Create(&model.UserCollection{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.UserCollection{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.UserCollection{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(userCollection.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.UserCollection{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(userCollection.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(userCollection.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.UserCollection{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/userenvironment.gen.go b/pkg/models/userenvironment.gen.go new file mode 100644 index 0000000..60d0245 --- /dev/null +++ b/pkg/models/userenvironment.gen.go @@ -0,0 +1,396 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUserEnvironment(db *gorm.DB, opts ...gen.DOOption) userEnvironment { + _userEnvironment := userEnvironment{} + + _userEnvironment.userEnvironmentDo.UseDB(db, opts...) + _userEnvironment.userEnvironmentDo.UseModel(&model.UserEnvironment{}) + + tableName := _userEnvironment.userEnvironmentDo.TableName() + _userEnvironment.ALL = field.NewAsterisk(tableName) + _userEnvironment.ID = field.NewString(tableName, "id") + _userEnvironment.UserUID = field.NewString(tableName, "userUid") + _userEnvironment.Name = field.NewString(tableName, "name") + _userEnvironment.Variables = field.NewField(tableName, "variables") + _userEnvironment.IsGlobal = field.NewBool(tableName, "isGlobal") + + _userEnvironment.fillFieldMap() + + return _userEnvironment +} + +type userEnvironment struct { + userEnvironmentDo + + ALL field.Asterisk + ID field.String + UserUID field.String + Name field.String + Variables field.Field + IsGlobal field.Bool + + fieldMap map[string]field.Expr +} + +func (u userEnvironment) Table(newTableName string) *userEnvironment { + u.userEnvironmentDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u userEnvironment) As(alias string) *userEnvironment { + u.userEnvironmentDo.DO = *(u.userEnvironmentDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *userEnvironment) updateTableName(table string) *userEnvironment { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewString(table, "id") + u.UserUID = field.NewString(table, "userUid") + u.Name = field.NewString(table, "name") + u.Variables = field.NewField(table, "variables") + u.IsGlobal = field.NewBool(table, "isGlobal") + + u.fillFieldMap() + + return u +} + +func (u *userEnvironment) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *userEnvironment) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 5) + u.fieldMap["id"] = u.ID + u.fieldMap["userUid"] = u.UserUID + u.fieldMap["name"] = u.Name + u.fieldMap["variables"] = u.Variables + u.fieldMap["isGlobal"] = u.IsGlobal +} + +func (u userEnvironment) clone(db *gorm.DB) userEnvironment { + u.userEnvironmentDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u userEnvironment) replaceDB(db *gorm.DB) userEnvironment { + u.userEnvironmentDo.ReplaceDB(db) + return u +} + +type userEnvironmentDo struct{ gen.DO } + +type IUserEnvironmentDo interface { + gen.SubQuery + Debug() IUserEnvironmentDo + WithContext(ctx context.Context) IUserEnvironmentDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserEnvironmentDo + WriteDB() IUserEnvironmentDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserEnvironmentDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserEnvironmentDo + Not(conds ...gen.Condition) IUserEnvironmentDo + Or(conds ...gen.Condition) IUserEnvironmentDo + Select(conds ...field.Expr) IUserEnvironmentDo + Where(conds ...gen.Condition) IUserEnvironmentDo + Order(conds ...field.Expr) IUserEnvironmentDo + Distinct(cols ...field.Expr) IUserEnvironmentDo + Omit(cols ...field.Expr) IUserEnvironmentDo + Join(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo + Group(cols ...field.Expr) IUserEnvironmentDo + Having(conds ...gen.Condition) IUserEnvironmentDo + Limit(limit int) IUserEnvironmentDo + Offset(offset int) IUserEnvironmentDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserEnvironmentDo + Unscoped() IUserEnvironmentDo + Create(values ...*model.UserEnvironment) error + CreateInBatches(values []*model.UserEnvironment, batchSize int) error + Save(values ...*model.UserEnvironment) error + First() (*model.UserEnvironment, error) + Take() (*model.UserEnvironment, error) + Last() (*model.UserEnvironment, error) + Find() ([]*model.UserEnvironment, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserEnvironment, err error) + FindInBatches(result *[]*model.UserEnvironment, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.UserEnvironment) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserEnvironmentDo + Assign(attrs ...field.AssignExpr) IUserEnvironmentDo + Joins(fields ...field.RelationField) IUserEnvironmentDo + Preload(fields ...field.RelationField) IUserEnvironmentDo + FirstOrInit() (*model.UserEnvironment, error) + FirstOrCreate() (*model.UserEnvironment, error) + FindByPage(offset int, limit int) (result []*model.UserEnvironment, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserEnvironmentDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userEnvironmentDo) Debug() IUserEnvironmentDo { + return u.withDO(u.DO.Debug()) +} + +func (u userEnvironmentDo) WithContext(ctx context.Context) IUserEnvironmentDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userEnvironmentDo) ReadDB() IUserEnvironmentDo { + return u.Clauses(dbresolver.Read) +} + +func (u userEnvironmentDo) WriteDB() IUserEnvironmentDo { + return u.Clauses(dbresolver.Write) +} + +func (u userEnvironmentDo) Session(config *gorm.Session) IUserEnvironmentDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userEnvironmentDo) Clauses(conds ...clause.Expression) IUserEnvironmentDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userEnvironmentDo) Returning(value interface{}, columns ...string) IUserEnvironmentDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userEnvironmentDo) Not(conds ...gen.Condition) IUserEnvironmentDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userEnvironmentDo) Or(conds ...gen.Condition) IUserEnvironmentDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userEnvironmentDo) Select(conds ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userEnvironmentDo) Where(conds ...gen.Condition) IUserEnvironmentDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userEnvironmentDo) Order(conds ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userEnvironmentDo) Distinct(cols ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userEnvironmentDo) Omit(cols ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userEnvironmentDo) Join(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userEnvironmentDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userEnvironmentDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userEnvironmentDo) Group(cols ...field.Expr) IUserEnvironmentDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userEnvironmentDo) Having(conds ...gen.Condition) IUserEnvironmentDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userEnvironmentDo) Limit(limit int) IUserEnvironmentDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userEnvironmentDo) Offset(offset int) IUserEnvironmentDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userEnvironmentDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserEnvironmentDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userEnvironmentDo) Unscoped() IUserEnvironmentDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userEnvironmentDo) Create(values ...*model.UserEnvironment) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userEnvironmentDo) CreateInBatches(values []*model.UserEnvironment, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userEnvironmentDo) Save(values ...*model.UserEnvironment) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userEnvironmentDo) First() (*model.UserEnvironment, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.UserEnvironment), nil + } +} + +func (u userEnvironmentDo) Take() (*model.UserEnvironment, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.UserEnvironment), nil + } +} + +func (u userEnvironmentDo) Last() (*model.UserEnvironment, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.UserEnvironment), nil + } +} + +func (u userEnvironmentDo) Find() ([]*model.UserEnvironment, error) { + result, err := u.DO.Find() + return result.([]*model.UserEnvironment), err +} + +func (u userEnvironmentDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserEnvironment, err error) { + buf := make([]*model.UserEnvironment, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userEnvironmentDo) FindInBatches(result *[]*model.UserEnvironment, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userEnvironmentDo) Attrs(attrs ...field.AssignExpr) IUserEnvironmentDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userEnvironmentDo) Assign(attrs ...field.AssignExpr) IUserEnvironmentDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userEnvironmentDo) Joins(fields ...field.RelationField) IUserEnvironmentDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userEnvironmentDo) Preload(fields ...field.RelationField) IUserEnvironmentDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userEnvironmentDo) FirstOrInit() (*model.UserEnvironment, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.UserEnvironment), nil + } +} + +func (u userEnvironmentDo) FirstOrCreate() (*model.UserEnvironment, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.UserEnvironment), nil + } +} + +func (u userEnvironmentDo) FindByPage(offset int, limit int) (result []*model.UserEnvironment, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userEnvironmentDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userEnvironmentDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userEnvironmentDo) Delete(models ...*model.UserEnvironment) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userEnvironmentDo) withDO(do gen.Dao) *userEnvironmentDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/userenvironment.gen_test.go b/pkg/models/userenvironment.gen_test.go new file mode 100644 index 0000000..2958230 --- /dev/null +++ b/pkg/models/userenvironment.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.UserEnvironment{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.UserEnvironment{}) fail: %s", err) + } +} + +func Test_userEnvironmentQuery(t *testing.T) { + userEnvironment := newUserEnvironment(db) + userEnvironment = *userEnvironment.As(userEnvironment.TableName()) + _do := userEnvironment.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(userEnvironment.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := userEnvironment.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from userEnvironment success") + } + + err = _do.Create(&model.UserEnvironment{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.UserEnvironment{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.UserEnvironment{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(userEnvironment.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.UserEnvironment{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(userEnvironment.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(userEnvironment.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.UserEnvironment{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/userhistory.gen.go b/pkg/models/userhistory.gen.go new file mode 100644 index 0000000..6526466 --- /dev/null +++ b/pkg/models/userhistory.gen.go @@ -0,0 +1,404 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUserHistory(db *gorm.DB, opts ...gen.DOOption) userHistory { + _userHistory := userHistory{} + + _userHistory.userHistoryDo.UseDB(db, opts...) + _userHistory.userHistoryDo.UseModel(&model.UserHistory{}) + + tableName := _userHistory.userHistoryDo.TableName() + _userHistory.ALL = field.NewAsterisk(tableName) + _userHistory.ID = field.NewString(tableName, "id") + _userHistory.UserUID = field.NewString(tableName, "userUid") + _userHistory.ReqType = field.NewField(tableName, "reqType") + _userHistory.Request = field.NewField(tableName, "request") + _userHistory.ResponseMetadata = field.NewField(tableName, "responseMetadata") + _userHistory.IsStarred = field.NewBool(tableName, "isStarred") + _userHistory.ExecutedOn = field.NewTime(tableName, "executedOn") + + _userHistory.fillFieldMap() + + return _userHistory +} + +type userHistory struct { + userHistoryDo + + ALL field.Asterisk + ID field.String + UserUID field.String + ReqType field.Field + Request field.Field + ResponseMetadata field.Field + IsStarred field.Bool + ExecutedOn field.Time + + fieldMap map[string]field.Expr +} + +func (u userHistory) Table(newTableName string) *userHistory { + u.userHistoryDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u userHistory) As(alias string) *userHistory { + u.userHistoryDo.DO = *(u.userHistoryDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *userHistory) updateTableName(table string) *userHistory { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewString(table, "id") + u.UserUID = field.NewString(table, "userUid") + u.ReqType = field.NewField(table, "reqType") + u.Request = field.NewField(table, "request") + u.ResponseMetadata = field.NewField(table, "responseMetadata") + u.IsStarred = field.NewBool(table, "isStarred") + u.ExecutedOn = field.NewTime(table, "executedOn") + + u.fillFieldMap() + + return u +} + +func (u *userHistory) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *userHistory) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 7) + u.fieldMap["id"] = u.ID + u.fieldMap["userUid"] = u.UserUID + u.fieldMap["reqType"] = u.ReqType + u.fieldMap["request"] = u.Request + u.fieldMap["responseMetadata"] = u.ResponseMetadata + u.fieldMap["isStarred"] = u.IsStarred + u.fieldMap["executedOn"] = u.ExecutedOn +} + +func (u userHistory) clone(db *gorm.DB) userHistory { + u.userHistoryDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u userHistory) replaceDB(db *gorm.DB) userHistory { + u.userHistoryDo.ReplaceDB(db) + return u +} + +type userHistoryDo struct{ gen.DO } + +type IUserHistoryDo interface { + gen.SubQuery + Debug() IUserHistoryDo + WithContext(ctx context.Context) IUserHistoryDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserHistoryDo + WriteDB() IUserHistoryDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserHistoryDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserHistoryDo + Not(conds ...gen.Condition) IUserHistoryDo + Or(conds ...gen.Condition) IUserHistoryDo + Select(conds ...field.Expr) IUserHistoryDo + Where(conds ...gen.Condition) IUserHistoryDo + Order(conds ...field.Expr) IUserHistoryDo + Distinct(cols ...field.Expr) IUserHistoryDo + Omit(cols ...field.Expr) IUserHistoryDo + Join(table schema.Tabler, on ...field.Expr) IUserHistoryDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserHistoryDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserHistoryDo + Group(cols ...field.Expr) IUserHistoryDo + Having(conds ...gen.Condition) IUserHistoryDo + Limit(limit int) IUserHistoryDo + Offset(offset int) IUserHistoryDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserHistoryDo + Unscoped() IUserHistoryDo + Create(values ...*model.UserHistory) error + CreateInBatches(values []*model.UserHistory, batchSize int) error + Save(values ...*model.UserHistory) error + First() (*model.UserHistory, error) + Take() (*model.UserHistory, error) + Last() (*model.UserHistory, error) + Find() ([]*model.UserHistory, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserHistory, err error) + FindInBatches(result *[]*model.UserHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.UserHistory) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserHistoryDo + Assign(attrs ...field.AssignExpr) IUserHistoryDo + Joins(fields ...field.RelationField) IUserHistoryDo + Preload(fields ...field.RelationField) IUserHistoryDo + FirstOrInit() (*model.UserHistory, error) + FirstOrCreate() (*model.UserHistory, error) + FindByPage(offset int, limit int) (result []*model.UserHistory, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserHistoryDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userHistoryDo) Debug() IUserHistoryDo { + return u.withDO(u.DO.Debug()) +} + +func (u userHistoryDo) WithContext(ctx context.Context) IUserHistoryDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userHistoryDo) ReadDB() IUserHistoryDo { + return u.Clauses(dbresolver.Read) +} + +func (u userHistoryDo) WriteDB() IUserHistoryDo { + return u.Clauses(dbresolver.Write) +} + +func (u userHistoryDo) Session(config *gorm.Session) IUserHistoryDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userHistoryDo) Clauses(conds ...clause.Expression) IUserHistoryDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userHistoryDo) Returning(value interface{}, columns ...string) IUserHistoryDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userHistoryDo) Not(conds ...gen.Condition) IUserHistoryDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userHistoryDo) Or(conds ...gen.Condition) IUserHistoryDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userHistoryDo) Select(conds ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userHistoryDo) Where(conds ...gen.Condition) IUserHistoryDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userHistoryDo) Order(conds ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userHistoryDo) Distinct(cols ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userHistoryDo) Omit(cols ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userHistoryDo) Join(table schema.Tabler, on ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userHistoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userHistoryDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userHistoryDo) Group(cols ...field.Expr) IUserHistoryDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userHistoryDo) Having(conds ...gen.Condition) IUserHistoryDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userHistoryDo) Limit(limit int) IUserHistoryDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userHistoryDo) Offset(offset int) IUserHistoryDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userHistoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserHistoryDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userHistoryDo) Unscoped() IUserHistoryDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userHistoryDo) Create(values ...*model.UserHistory) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userHistoryDo) CreateInBatches(values []*model.UserHistory, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userHistoryDo) Save(values ...*model.UserHistory) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userHistoryDo) First() (*model.UserHistory, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.UserHistory), nil + } +} + +func (u userHistoryDo) Take() (*model.UserHistory, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.UserHistory), nil + } +} + +func (u userHistoryDo) Last() (*model.UserHistory, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.UserHistory), nil + } +} + +func (u userHistoryDo) Find() ([]*model.UserHistory, error) { + result, err := u.DO.Find() + return result.([]*model.UserHistory), err +} + +func (u userHistoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserHistory, err error) { + buf := make([]*model.UserHistory, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userHistoryDo) FindInBatches(result *[]*model.UserHistory, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userHistoryDo) Attrs(attrs ...field.AssignExpr) IUserHistoryDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userHistoryDo) Assign(attrs ...field.AssignExpr) IUserHistoryDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userHistoryDo) Joins(fields ...field.RelationField) IUserHistoryDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userHistoryDo) Preload(fields ...field.RelationField) IUserHistoryDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userHistoryDo) FirstOrInit() (*model.UserHistory, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.UserHistory), nil + } +} + +func (u userHistoryDo) FirstOrCreate() (*model.UserHistory, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.UserHistory), nil + } +} + +func (u userHistoryDo) FindByPage(offset int, limit int) (result []*model.UserHistory, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userHistoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userHistoryDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userHistoryDo) Delete(models ...*model.UserHistory) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userHistoryDo) withDO(do gen.Dao) *userHistoryDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/userhistory.gen_test.go b/pkg/models/userhistory.gen_test.go new file mode 100644 index 0000000..a56bf9f --- /dev/null +++ b/pkg/models/userhistory.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.UserHistory{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.UserHistory{}) fail: %s", err) + } +} + +func Test_userHistoryQuery(t *testing.T) { + userHistory := newUserHistory(db) + userHistory = *userHistory.As(userHistory.TableName()) + _do := userHistory.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(userHistory.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := userHistory.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from userHistory success") + } + + err = _do.Create(&model.UserHistory{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.UserHistory{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.UserHistory{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(userHistory.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.UserHistory{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(userHistory.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(userHistory.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.UserHistory{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/userrequest.gen.go b/pkg/models/userrequest.gen.go new file mode 100644 index 0000000..f618ef2 --- /dev/null +++ b/pkg/models/userrequest.gen.go @@ -0,0 +1,412 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUserRequest(db *gorm.DB, opts ...gen.DOOption) userRequest { + _userRequest := userRequest{} + + _userRequest.userRequestDo.UseDB(db, opts...) + _userRequest.userRequestDo.UseModel(&model.UserRequest{}) + + tableName := _userRequest.userRequestDo.TableName() + _userRequest.ALL = field.NewAsterisk(tableName) + _userRequest.ID = field.NewString(tableName, "id") + _userRequest.CollectionID = field.NewString(tableName, "collectionID") + _userRequest.UserUID = field.NewString(tableName, "userUid") + _userRequest.Title = field.NewString(tableName, "title") + _userRequest.Request = field.NewField(tableName, "request") + _userRequest.Type = field.NewField(tableName, "type") + _userRequest.OrderIndex = field.NewInt32(tableName, "orderIndex") + _userRequest.CreatedOn = field.NewTime(tableName, "createdOn") + _userRequest.UpdatedOn = field.NewTime(tableName, "updatedOn") + + _userRequest.fillFieldMap() + + return _userRequest +} + +type userRequest struct { + userRequestDo + + ALL field.Asterisk + ID field.String + CollectionID field.String + UserUID field.String + Title field.String + Request field.Field + Type field.Field + OrderIndex field.Int32 + CreatedOn field.Time + UpdatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (u userRequest) Table(newTableName string) *userRequest { + u.userRequestDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u userRequest) As(alias string) *userRequest { + u.userRequestDo.DO = *(u.userRequestDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *userRequest) updateTableName(table string) *userRequest { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewString(table, "id") + u.CollectionID = field.NewString(table, "collectionID") + u.UserUID = field.NewString(table, "userUid") + u.Title = field.NewString(table, "title") + u.Request = field.NewField(table, "request") + u.Type = field.NewField(table, "type") + u.OrderIndex = field.NewInt32(table, "orderIndex") + u.CreatedOn = field.NewTime(table, "createdOn") + u.UpdatedOn = field.NewTime(table, "updatedOn") + + u.fillFieldMap() + + return u +} + +func (u *userRequest) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *userRequest) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 9) + u.fieldMap["id"] = u.ID + u.fieldMap["collectionID"] = u.CollectionID + u.fieldMap["userUid"] = u.UserUID + u.fieldMap["title"] = u.Title + u.fieldMap["request"] = u.Request + u.fieldMap["type"] = u.Type + u.fieldMap["orderIndex"] = u.OrderIndex + u.fieldMap["createdOn"] = u.CreatedOn + u.fieldMap["updatedOn"] = u.UpdatedOn +} + +func (u userRequest) clone(db *gorm.DB) userRequest { + u.userRequestDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u userRequest) replaceDB(db *gorm.DB) userRequest { + u.userRequestDo.ReplaceDB(db) + return u +} + +type userRequestDo struct{ gen.DO } + +type IUserRequestDo interface { + gen.SubQuery + Debug() IUserRequestDo + WithContext(ctx context.Context) IUserRequestDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserRequestDo + WriteDB() IUserRequestDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserRequestDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserRequestDo + Not(conds ...gen.Condition) IUserRequestDo + Or(conds ...gen.Condition) IUserRequestDo + Select(conds ...field.Expr) IUserRequestDo + Where(conds ...gen.Condition) IUserRequestDo + Order(conds ...field.Expr) IUserRequestDo + Distinct(cols ...field.Expr) IUserRequestDo + Omit(cols ...field.Expr) IUserRequestDo + Join(table schema.Tabler, on ...field.Expr) IUserRequestDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserRequestDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserRequestDo + Group(cols ...field.Expr) IUserRequestDo + Having(conds ...gen.Condition) IUserRequestDo + Limit(limit int) IUserRequestDo + Offset(offset int) IUserRequestDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserRequestDo + Unscoped() IUserRequestDo + Create(values ...*model.UserRequest) error + CreateInBatches(values []*model.UserRequest, batchSize int) error + Save(values ...*model.UserRequest) error + First() (*model.UserRequest, error) + Take() (*model.UserRequest, error) + Last() (*model.UserRequest, error) + Find() ([]*model.UserRequest, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserRequest, err error) + FindInBatches(result *[]*model.UserRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.UserRequest) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserRequestDo + Assign(attrs ...field.AssignExpr) IUserRequestDo + Joins(fields ...field.RelationField) IUserRequestDo + Preload(fields ...field.RelationField) IUserRequestDo + FirstOrInit() (*model.UserRequest, error) + FirstOrCreate() (*model.UserRequest, error) + FindByPage(offset int, limit int) (result []*model.UserRequest, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserRequestDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userRequestDo) Debug() IUserRequestDo { + return u.withDO(u.DO.Debug()) +} + +func (u userRequestDo) WithContext(ctx context.Context) IUserRequestDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userRequestDo) ReadDB() IUserRequestDo { + return u.Clauses(dbresolver.Read) +} + +func (u userRequestDo) WriteDB() IUserRequestDo { + return u.Clauses(dbresolver.Write) +} + +func (u userRequestDo) Session(config *gorm.Session) IUserRequestDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userRequestDo) Clauses(conds ...clause.Expression) IUserRequestDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userRequestDo) Returning(value interface{}, columns ...string) IUserRequestDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userRequestDo) Not(conds ...gen.Condition) IUserRequestDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userRequestDo) Or(conds ...gen.Condition) IUserRequestDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userRequestDo) Select(conds ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userRequestDo) Where(conds ...gen.Condition) IUserRequestDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userRequestDo) Order(conds ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userRequestDo) Distinct(cols ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userRequestDo) Omit(cols ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userRequestDo) Join(table schema.Tabler, on ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userRequestDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userRequestDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userRequestDo) Group(cols ...field.Expr) IUserRequestDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userRequestDo) Having(conds ...gen.Condition) IUserRequestDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userRequestDo) Limit(limit int) IUserRequestDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userRequestDo) Offset(offset int) IUserRequestDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userRequestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserRequestDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userRequestDo) Unscoped() IUserRequestDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userRequestDo) Create(values ...*model.UserRequest) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userRequestDo) CreateInBatches(values []*model.UserRequest, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userRequestDo) Save(values ...*model.UserRequest) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userRequestDo) First() (*model.UserRequest, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.UserRequest), nil + } +} + +func (u userRequestDo) Take() (*model.UserRequest, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.UserRequest), nil + } +} + +func (u userRequestDo) Last() (*model.UserRequest, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.UserRequest), nil + } +} + +func (u userRequestDo) Find() ([]*model.UserRequest, error) { + result, err := u.DO.Find() + return result.([]*model.UserRequest), err +} + +func (u userRequestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserRequest, err error) { + buf := make([]*model.UserRequest, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userRequestDo) FindInBatches(result *[]*model.UserRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userRequestDo) Attrs(attrs ...field.AssignExpr) IUserRequestDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userRequestDo) Assign(attrs ...field.AssignExpr) IUserRequestDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userRequestDo) Joins(fields ...field.RelationField) IUserRequestDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userRequestDo) Preload(fields ...field.RelationField) IUserRequestDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userRequestDo) FirstOrInit() (*model.UserRequest, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.UserRequest), nil + } +} + +func (u userRequestDo) FirstOrCreate() (*model.UserRequest, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.UserRequest), nil + } +} + +func (u userRequestDo) FindByPage(offset int, limit int) (result []*model.UserRequest, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userRequestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userRequestDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userRequestDo) Delete(models ...*model.UserRequest) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userRequestDo) withDO(do gen.Dao) *userRequestDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/userrequest.gen_test.go b/pkg/models/userrequest.gen_test.go new file mode 100644 index 0000000..6cb8699 --- /dev/null +++ b/pkg/models/userrequest.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.UserRequest{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.UserRequest{}) fail: %s", err) + } +} + +func Test_userRequestQuery(t *testing.T) { + userRequest := newUserRequest(db) + userRequest = *userRequest.As(userRequest.TableName()) + _do := userRequest.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(userRequest.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := userRequest.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from userRequest success") + } + + err = _do.Create(&model.UserRequest{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.UserRequest{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.UserRequest{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(userRequest.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.UserRequest{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(userRequest.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(userRequest.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.UserRequest{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/usersettings.gen.go b/pkg/models/usersettings.gen.go new file mode 100644 index 0000000..a53047b --- /dev/null +++ b/pkg/models/usersettings.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newUserSetting(db *gorm.DB, opts ...gen.DOOption) userSetting { + _userSetting := userSetting{} + + _userSetting.userSettingDo.UseDB(db, opts...) + _userSetting.userSettingDo.UseModel(&model.UserSetting{}) + + tableName := _userSetting.userSettingDo.TableName() + _userSetting.ALL = field.NewAsterisk(tableName) + _userSetting.ID = field.NewString(tableName, "id") + _userSetting.UserUID = field.NewString(tableName, "userUid") + _userSetting.Properties = field.NewField(tableName, "properties") + _userSetting.UpdatedOn = field.NewTime(tableName, "updatedOn") + + _userSetting.fillFieldMap() + + return _userSetting +} + +type userSetting struct { + userSettingDo + + ALL field.Asterisk + ID field.String + UserUID field.String + Properties field.Field + UpdatedOn field.Time + + fieldMap map[string]field.Expr +} + +func (u userSetting) Table(newTableName string) *userSetting { + u.userSettingDo.UseTable(newTableName) + return u.updateTableName(newTableName) +} + +func (u userSetting) As(alias string) *userSetting { + u.userSettingDo.DO = *(u.userSettingDo.As(alias).(*gen.DO)) + return u.updateTableName(alias) +} + +func (u *userSetting) updateTableName(table string) *userSetting { + u.ALL = field.NewAsterisk(table) + u.ID = field.NewString(table, "id") + u.UserUID = field.NewString(table, "userUid") + u.Properties = field.NewField(table, "properties") + u.UpdatedOn = field.NewTime(table, "updatedOn") + + u.fillFieldMap() + + return u +} + +func (u *userSetting) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := u.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (u *userSetting) fillFieldMap() { + u.fieldMap = make(map[string]field.Expr, 4) + u.fieldMap["id"] = u.ID + u.fieldMap["userUid"] = u.UserUID + u.fieldMap["properties"] = u.Properties + u.fieldMap["updatedOn"] = u.UpdatedOn +} + +func (u userSetting) clone(db *gorm.DB) userSetting { + u.userSettingDo.ReplaceConnPool(db.Statement.ConnPool) + return u +} + +func (u userSetting) replaceDB(db *gorm.DB) userSetting { + u.userSettingDo.ReplaceDB(db) + return u +} + +type userSettingDo struct{ gen.DO } + +type IUserSettingDo interface { + gen.SubQuery + Debug() IUserSettingDo + WithContext(ctx context.Context) IUserSettingDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IUserSettingDo + WriteDB() IUserSettingDo + As(alias string) gen.Dao + Session(config *gorm.Session) IUserSettingDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IUserSettingDo + Not(conds ...gen.Condition) IUserSettingDo + Or(conds ...gen.Condition) IUserSettingDo + Select(conds ...field.Expr) IUserSettingDo + Where(conds ...gen.Condition) IUserSettingDo + Order(conds ...field.Expr) IUserSettingDo + Distinct(cols ...field.Expr) IUserSettingDo + Omit(cols ...field.Expr) IUserSettingDo + Join(table schema.Tabler, on ...field.Expr) IUserSettingDo + LeftJoin(table schema.Tabler, on ...field.Expr) IUserSettingDo + RightJoin(table schema.Tabler, on ...field.Expr) IUserSettingDo + Group(cols ...field.Expr) IUserSettingDo + Having(conds ...gen.Condition) IUserSettingDo + Limit(limit int) IUserSettingDo + Offset(offset int) IUserSettingDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IUserSettingDo + Unscoped() IUserSettingDo + Create(values ...*model.UserSetting) error + CreateInBatches(values []*model.UserSetting, batchSize int) error + Save(values ...*model.UserSetting) error + First() (*model.UserSetting, error) + Take() (*model.UserSetting, error) + Last() (*model.UserSetting, error) + Find() ([]*model.UserSetting, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserSetting, err error) + FindInBatches(result *[]*model.UserSetting, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.UserSetting) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IUserSettingDo + Assign(attrs ...field.AssignExpr) IUserSettingDo + Joins(fields ...field.RelationField) IUserSettingDo + Preload(fields ...field.RelationField) IUserSettingDo + FirstOrInit() (*model.UserSetting, error) + FirstOrCreate() (*model.UserSetting, error) + FindByPage(offset int, limit int) (result []*model.UserSetting, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IUserSettingDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (u userSettingDo) Debug() IUserSettingDo { + return u.withDO(u.DO.Debug()) +} + +func (u userSettingDo) WithContext(ctx context.Context) IUserSettingDo { + return u.withDO(u.DO.WithContext(ctx)) +} + +func (u userSettingDo) ReadDB() IUserSettingDo { + return u.Clauses(dbresolver.Read) +} + +func (u userSettingDo) WriteDB() IUserSettingDo { + return u.Clauses(dbresolver.Write) +} + +func (u userSettingDo) Session(config *gorm.Session) IUserSettingDo { + return u.withDO(u.DO.Session(config)) +} + +func (u userSettingDo) Clauses(conds ...clause.Expression) IUserSettingDo { + return u.withDO(u.DO.Clauses(conds...)) +} + +func (u userSettingDo) Returning(value interface{}, columns ...string) IUserSettingDo { + return u.withDO(u.DO.Returning(value, columns...)) +} + +func (u userSettingDo) Not(conds ...gen.Condition) IUserSettingDo { + return u.withDO(u.DO.Not(conds...)) +} + +func (u userSettingDo) Or(conds ...gen.Condition) IUserSettingDo { + return u.withDO(u.DO.Or(conds...)) +} + +func (u userSettingDo) Select(conds ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Select(conds...)) +} + +func (u userSettingDo) Where(conds ...gen.Condition) IUserSettingDo { + return u.withDO(u.DO.Where(conds...)) +} + +func (u userSettingDo) Order(conds ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Order(conds...)) +} + +func (u userSettingDo) Distinct(cols ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Distinct(cols...)) +} + +func (u userSettingDo) Omit(cols ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Omit(cols...)) +} + +func (u userSettingDo) Join(table schema.Tabler, on ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Join(table, on...)) +} + +func (u userSettingDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.LeftJoin(table, on...)) +} + +func (u userSettingDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.RightJoin(table, on...)) +} + +func (u userSettingDo) Group(cols ...field.Expr) IUserSettingDo { + return u.withDO(u.DO.Group(cols...)) +} + +func (u userSettingDo) Having(conds ...gen.Condition) IUserSettingDo { + return u.withDO(u.DO.Having(conds...)) +} + +func (u userSettingDo) Limit(limit int) IUserSettingDo { + return u.withDO(u.DO.Limit(limit)) +} + +func (u userSettingDo) Offset(offset int) IUserSettingDo { + return u.withDO(u.DO.Offset(offset)) +} + +func (u userSettingDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserSettingDo { + return u.withDO(u.DO.Scopes(funcs...)) +} + +func (u userSettingDo) Unscoped() IUserSettingDo { + return u.withDO(u.DO.Unscoped()) +} + +func (u userSettingDo) Create(values ...*model.UserSetting) error { + if len(values) == 0 { + return nil + } + return u.DO.Create(values) +} + +func (u userSettingDo) CreateInBatches(values []*model.UserSetting, batchSize int) error { + return u.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (u userSettingDo) Save(values ...*model.UserSetting) error { + if len(values) == 0 { + return nil + } + return u.DO.Save(values) +} + +func (u userSettingDo) First() (*model.UserSetting, error) { + if result, err := u.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.UserSetting), nil + } +} + +func (u userSettingDo) Take() (*model.UserSetting, error) { + if result, err := u.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.UserSetting), nil + } +} + +func (u userSettingDo) Last() (*model.UserSetting, error) { + if result, err := u.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.UserSetting), nil + } +} + +func (u userSettingDo) Find() ([]*model.UserSetting, error) { + result, err := u.DO.Find() + return result.([]*model.UserSetting), err +} + +func (u userSettingDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.UserSetting, err error) { + buf := make([]*model.UserSetting, 0, batchSize) + err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (u userSettingDo) FindInBatches(result *[]*model.UserSetting, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return u.DO.FindInBatches(result, batchSize, fc) +} + +func (u userSettingDo) Attrs(attrs ...field.AssignExpr) IUserSettingDo { + return u.withDO(u.DO.Attrs(attrs...)) +} + +func (u userSettingDo) Assign(attrs ...field.AssignExpr) IUserSettingDo { + return u.withDO(u.DO.Assign(attrs...)) +} + +func (u userSettingDo) Joins(fields ...field.RelationField) IUserSettingDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Joins(_f)) + } + return &u +} + +func (u userSettingDo) Preload(fields ...field.RelationField) IUserSettingDo { + for _, _f := range fields { + u = *u.withDO(u.DO.Preload(_f)) + } + return &u +} + +func (u userSettingDo) FirstOrInit() (*model.UserSetting, error) { + if result, err := u.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.UserSetting), nil + } +} + +func (u userSettingDo) FirstOrCreate() (*model.UserSetting, error) { + if result, err := u.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.UserSetting), nil + } +} + +func (u userSettingDo) FindByPage(offset int, limit int) (result []*model.UserSetting, count int64, err error) { + result, err = u.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = u.Offset(-1).Limit(-1).Count() + return +} + +func (u userSettingDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = u.Count() + if err != nil { + return + } + + err = u.Offset(offset).Limit(limit).Scan(result) + return +} + +func (u userSettingDo) Scan(result interface{}) (err error) { + return u.DO.Scan(result) +} + +func (u userSettingDo) Delete(models ...*model.UserSetting) (result gen.ResultInfo, err error) { + return u.DO.Delete(models) +} + +func (u *userSettingDo) withDO(do gen.Dao) *userSettingDo { + u.DO = *do.(*gen.DO) + return u +} diff --git a/pkg/models/usersettings.gen_test.go b/pkg/models/usersettings.gen_test.go new file mode 100644 index 0000000..f718f5c --- /dev/null +++ b/pkg/models/usersettings.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.UserSetting{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.UserSetting{}) fail: %s", err) + } +} + +func Test_userSettingQuery(t *testing.T) { + userSetting := newUserSetting(db) + userSetting = *userSetting.As(userSetting.TableName()) + _do := userSetting.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(userSetting.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := userSetting.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from userSetting success") + } + + err = _do.Create(&model.UserSetting{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.UserSetting{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.UserSetting{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(userSetting.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.UserSetting{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(userSetting.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(userSetting.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.UserSetting{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/models/verificationtoken.gen.go b/pkg/models/verificationtoken.gen.go new file mode 100644 index 0000000..8526965 --- /dev/null +++ b/pkg/models/verificationtoken.gen.go @@ -0,0 +1,392 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + + "gorm.io/gorm" + "gorm.io/gorm/clause" + "gorm.io/gorm/schema" + + "gorm.io/gen" + "gorm.io/gen/field" + + "gorm.io/plugin/dbresolver" + + "model" +) + +func newVerificationToken(db *gorm.DB, opts ...gen.DOOption) verificationToken { + _verificationToken := verificationToken{} + + _verificationToken.verificationTokenDo.UseDB(db, opts...) + _verificationToken.verificationTokenDo.UseModel(&model.VerificationToken{}) + + tableName := _verificationToken.verificationTokenDo.TableName() + _verificationToken.ALL = field.NewAsterisk(tableName) + _verificationToken.DeviceIdentifier = field.NewString(tableName, "deviceIdentifier") + _verificationToken.Token = field.NewString(tableName, "token") + _verificationToken.UserUID = field.NewString(tableName, "userUid") + _verificationToken.ExpiresOn = field.NewTime(tableName, "expiresOn") + + _verificationToken.fillFieldMap() + + return _verificationToken +} + +type verificationToken struct { + verificationTokenDo + + ALL field.Asterisk + DeviceIdentifier field.String + Token field.String + UserUID field.String + ExpiresOn field.Time + + fieldMap map[string]field.Expr +} + +func (v verificationToken) Table(newTableName string) *verificationToken { + v.verificationTokenDo.UseTable(newTableName) + return v.updateTableName(newTableName) +} + +func (v verificationToken) As(alias string) *verificationToken { + v.verificationTokenDo.DO = *(v.verificationTokenDo.As(alias).(*gen.DO)) + return v.updateTableName(alias) +} + +func (v *verificationToken) updateTableName(table string) *verificationToken { + v.ALL = field.NewAsterisk(table) + v.DeviceIdentifier = field.NewString(table, "deviceIdentifier") + v.Token = field.NewString(table, "token") + v.UserUID = field.NewString(table, "userUid") + v.ExpiresOn = field.NewTime(table, "expiresOn") + + v.fillFieldMap() + + return v +} + +func (v *verificationToken) GetFieldByName(fieldName string) (field.OrderExpr, bool) { + _f, ok := v.fieldMap[fieldName] + if !ok || _f == nil { + return nil, false + } + _oe, ok := _f.(field.OrderExpr) + return _oe, ok +} + +func (v *verificationToken) fillFieldMap() { + v.fieldMap = make(map[string]field.Expr, 4) + v.fieldMap["deviceIdentifier"] = v.DeviceIdentifier + v.fieldMap["token"] = v.Token + v.fieldMap["userUid"] = v.UserUID + v.fieldMap["expiresOn"] = v.ExpiresOn +} + +func (v verificationToken) clone(db *gorm.DB) verificationToken { + v.verificationTokenDo.ReplaceConnPool(db.Statement.ConnPool) + return v +} + +func (v verificationToken) replaceDB(db *gorm.DB) verificationToken { + v.verificationTokenDo.ReplaceDB(db) + return v +} + +type verificationTokenDo struct{ gen.DO } + +type IVerificationTokenDo interface { + gen.SubQuery + Debug() IVerificationTokenDo + WithContext(ctx context.Context) IVerificationTokenDo + WithResult(fc func(tx gen.Dao)) gen.ResultInfo + ReplaceDB(db *gorm.DB) + ReadDB() IVerificationTokenDo + WriteDB() IVerificationTokenDo + As(alias string) gen.Dao + Session(config *gorm.Session) IVerificationTokenDo + Columns(cols ...field.Expr) gen.Columns + Clauses(conds ...clause.Expression) IVerificationTokenDo + Not(conds ...gen.Condition) IVerificationTokenDo + Or(conds ...gen.Condition) IVerificationTokenDo + Select(conds ...field.Expr) IVerificationTokenDo + Where(conds ...gen.Condition) IVerificationTokenDo + Order(conds ...field.Expr) IVerificationTokenDo + Distinct(cols ...field.Expr) IVerificationTokenDo + Omit(cols ...field.Expr) IVerificationTokenDo + Join(table schema.Tabler, on ...field.Expr) IVerificationTokenDo + LeftJoin(table schema.Tabler, on ...field.Expr) IVerificationTokenDo + RightJoin(table schema.Tabler, on ...field.Expr) IVerificationTokenDo + Group(cols ...field.Expr) IVerificationTokenDo + Having(conds ...gen.Condition) IVerificationTokenDo + Limit(limit int) IVerificationTokenDo + Offset(offset int) IVerificationTokenDo + Count() (count int64, err error) + Scopes(funcs ...func(gen.Dao) gen.Dao) IVerificationTokenDo + Unscoped() IVerificationTokenDo + Create(values ...*model.VerificationToken) error + CreateInBatches(values []*model.VerificationToken, batchSize int) error + Save(values ...*model.VerificationToken) error + First() (*model.VerificationToken, error) + Take() (*model.VerificationToken, error) + Last() (*model.VerificationToken, error) + Find() ([]*model.VerificationToken, error) + FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VerificationToken, err error) + FindInBatches(result *[]*model.VerificationToken, batchSize int, fc func(tx gen.Dao, batch int) error) error + Pluck(column field.Expr, dest interface{}) error + Delete(...*model.VerificationToken) (info gen.ResultInfo, err error) + Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + Updates(value interface{}) (info gen.ResultInfo, err error) + UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error) + UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error) + UpdateColumns(value interface{}) (info gen.ResultInfo, err error) + UpdateFrom(q gen.SubQuery) gen.Dao + Attrs(attrs ...field.AssignExpr) IVerificationTokenDo + Assign(attrs ...field.AssignExpr) IVerificationTokenDo + Joins(fields ...field.RelationField) IVerificationTokenDo + Preload(fields ...field.RelationField) IVerificationTokenDo + FirstOrInit() (*model.VerificationToken, error) + FirstOrCreate() (*model.VerificationToken, error) + FindByPage(offset int, limit int) (result []*model.VerificationToken, count int64, err error) + ScanByPage(result interface{}, offset int, limit int) (count int64, err error) + Scan(result interface{}) (err error) + Returning(value interface{}, columns ...string) IVerificationTokenDo + UnderlyingDB() *gorm.DB + schema.Tabler +} + +func (v verificationTokenDo) Debug() IVerificationTokenDo { + return v.withDO(v.DO.Debug()) +} + +func (v verificationTokenDo) WithContext(ctx context.Context) IVerificationTokenDo { + return v.withDO(v.DO.WithContext(ctx)) +} + +func (v verificationTokenDo) ReadDB() IVerificationTokenDo { + return v.Clauses(dbresolver.Read) +} + +func (v verificationTokenDo) WriteDB() IVerificationTokenDo { + return v.Clauses(dbresolver.Write) +} + +func (v verificationTokenDo) Session(config *gorm.Session) IVerificationTokenDo { + return v.withDO(v.DO.Session(config)) +} + +func (v verificationTokenDo) Clauses(conds ...clause.Expression) IVerificationTokenDo { + return v.withDO(v.DO.Clauses(conds...)) +} + +func (v verificationTokenDo) Returning(value interface{}, columns ...string) IVerificationTokenDo { + return v.withDO(v.DO.Returning(value, columns...)) +} + +func (v verificationTokenDo) Not(conds ...gen.Condition) IVerificationTokenDo { + return v.withDO(v.DO.Not(conds...)) +} + +func (v verificationTokenDo) Or(conds ...gen.Condition) IVerificationTokenDo { + return v.withDO(v.DO.Or(conds...)) +} + +func (v verificationTokenDo) Select(conds ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Select(conds...)) +} + +func (v verificationTokenDo) Where(conds ...gen.Condition) IVerificationTokenDo { + return v.withDO(v.DO.Where(conds...)) +} + +func (v verificationTokenDo) Order(conds ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Order(conds...)) +} + +func (v verificationTokenDo) Distinct(cols ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Distinct(cols...)) +} + +func (v verificationTokenDo) Omit(cols ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Omit(cols...)) +} + +func (v verificationTokenDo) Join(table schema.Tabler, on ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Join(table, on...)) +} + +func (v verificationTokenDo) LeftJoin(table schema.Tabler, on ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.LeftJoin(table, on...)) +} + +func (v verificationTokenDo) RightJoin(table schema.Tabler, on ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.RightJoin(table, on...)) +} + +func (v verificationTokenDo) Group(cols ...field.Expr) IVerificationTokenDo { + return v.withDO(v.DO.Group(cols...)) +} + +func (v verificationTokenDo) Having(conds ...gen.Condition) IVerificationTokenDo { + return v.withDO(v.DO.Having(conds...)) +} + +func (v verificationTokenDo) Limit(limit int) IVerificationTokenDo { + return v.withDO(v.DO.Limit(limit)) +} + +func (v verificationTokenDo) Offset(offset int) IVerificationTokenDo { + return v.withDO(v.DO.Offset(offset)) +} + +func (v verificationTokenDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IVerificationTokenDo { + return v.withDO(v.DO.Scopes(funcs...)) +} + +func (v verificationTokenDo) Unscoped() IVerificationTokenDo { + return v.withDO(v.DO.Unscoped()) +} + +func (v verificationTokenDo) Create(values ...*model.VerificationToken) error { + if len(values) == 0 { + return nil + } + return v.DO.Create(values) +} + +func (v verificationTokenDo) CreateInBatches(values []*model.VerificationToken, batchSize int) error { + return v.DO.CreateInBatches(values, batchSize) +} + +// Save : !!! underlying implementation is different with GORM +// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values) +func (v verificationTokenDo) Save(values ...*model.VerificationToken) error { + if len(values) == 0 { + return nil + } + return v.DO.Save(values) +} + +func (v verificationTokenDo) First() (*model.VerificationToken, error) { + if result, err := v.DO.First(); err != nil { + return nil, err + } else { + return result.(*model.VerificationToken), nil + } +} + +func (v verificationTokenDo) Take() (*model.VerificationToken, error) { + if result, err := v.DO.Take(); err != nil { + return nil, err + } else { + return result.(*model.VerificationToken), nil + } +} + +func (v verificationTokenDo) Last() (*model.VerificationToken, error) { + if result, err := v.DO.Last(); err != nil { + return nil, err + } else { + return result.(*model.VerificationToken), nil + } +} + +func (v verificationTokenDo) Find() ([]*model.VerificationToken, error) { + result, err := v.DO.Find() + return result.([]*model.VerificationToken), err +} + +func (v verificationTokenDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VerificationToken, err error) { + buf := make([]*model.VerificationToken, 0, batchSize) + err = v.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error { + defer func() { results = append(results, buf...) }() + return fc(tx, batch) + }) + return results, err +} + +func (v verificationTokenDo) FindInBatches(result *[]*model.VerificationToken, batchSize int, fc func(tx gen.Dao, batch int) error) error { + return v.DO.FindInBatches(result, batchSize, fc) +} + +func (v verificationTokenDo) Attrs(attrs ...field.AssignExpr) IVerificationTokenDo { + return v.withDO(v.DO.Attrs(attrs...)) +} + +func (v verificationTokenDo) Assign(attrs ...field.AssignExpr) IVerificationTokenDo { + return v.withDO(v.DO.Assign(attrs...)) +} + +func (v verificationTokenDo) Joins(fields ...field.RelationField) IVerificationTokenDo { + for _, _f := range fields { + v = *v.withDO(v.DO.Joins(_f)) + } + return &v +} + +func (v verificationTokenDo) Preload(fields ...field.RelationField) IVerificationTokenDo { + for _, _f := range fields { + v = *v.withDO(v.DO.Preload(_f)) + } + return &v +} + +func (v verificationTokenDo) FirstOrInit() (*model.VerificationToken, error) { + if result, err := v.DO.FirstOrInit(); err != nil { + return nil, err + } else { + return result.(*model.VerificationToken), nil + } +} + +func (v verificationTokenDo) FirstOrCreate() (*model.VerificationToken, error) { + if result, err := v.DO.FirstOrCreate(); err != nil { + return nil, err + } else { + return result.(*model.VerificationToken), nil + } +} + +func (v verificationTokenDo) FindByPage(offset int, limit int) (result []*model.VerificationToken, count int64, err error) { + result, err = v.Offset(offset).Limit(limit).Find() + if err != nil { + return + } + + if size := len(result); 0 < limit && 0 < size && size < limit { + count = int64(size + offset) + return + } + + count, err = v.Offset(-1).Limit(-1).Count() + return +} + +func (v verificationTokenDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) { + count, err = v.Count() + if err != nil { + return + } + + err = v.Offset(offset).Limit(limit).Scan(result) + return +} + +func (v verificationTokenDo) Scan(result interface{}) (err error) { + return v.DO.Scan(result) +} + +func (v verificationTokenDo) Delete(models ...*model.VerificationToken) (result gen.ResultInfo, err error) { + return v.DO.Delete(models) +} + +func (v *verificationTokenDo) withDO(do gen.Dao) *verificationTokenDo { + v.DO = *do.(*gen.DO) + return v +} diff --git a/pkg/models/verificationtoken.gen_test.go b/pkg/models/verificationtoken.gen_test.go new file mode 100644 index 0000000..fd49b6a --- /dev/null +++ b/pkg/models/verificationtoken.gen_test.go @@ -0,0 +1,146 @@ +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. +// Code generated by gorm.io/gen. DO NOT EDIT. + +package models + +import ( + "context" + "fmt" + "testing" + + "model" + + "gorm.io/gen" + "gorm.io/gen/field" + "gorm.io/gorm/clause" +) + +func init() { + InitializeDB() + err := db.AutoMigrate(&model.VerificationToken{}) + if err != nil { + fmt.Printf("Error: AutoMigrate(&model.VerificationToken{}) fail: %s", err) + } +} + +func Test_verificationTokenQuery(t *testing.T) { + verificationToken := newVerificationToken(db) + verificationToken = *verificationToken.As(verificationToken.TableName()) + _do := verificationToken.WithContext(context.Background()).Debug() + + primaryKey := field.NewString(verificationToken.TableName(), clause.PrimaryKey) + _, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete() + if err != nil { + t.Error("clean table fail:", err) + return + } + + _, ok := verificationToken.GetFieldByName("") + if ok { + t.Error("GetFieldByName(\"\") from verificationToken success") + } + + err = _do.Create(&model.VerificationToken{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.Save(&model.VerificationToken{}) + if err != nil { + t.Error("create item in table fail:", err) + } + + err = _do.CreateInBatches([]*model.VerificationToken{{}, {}}, 10) + if err != nil { + t.Error("create item in table fail:", err) + } + + _, err = _do.Select(verificationToken.ALL).Take() + if err != nil { + t.Error("Take() on table fail:", err) + } + + _, err = _do.First() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Last() + if err != nil { + t.Error("First() on table fail:", err) + } + + _, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatch() on table fail:", err) + } + + err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.VerificationToken{}, 10, func(tx gen.Dao, batch int) error { return nil }) + if err != nil { + t.Error("FindInBatches() on table fail:", err) + } + + _, err = _do.Select(verificationToken.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find() + if err != nil { + t.Error("Find() on table fail:", err) + } + + _, err = _do.Distinct(primaryKey).Take() + if err != nil { + t.Error("select Distinct() on table fail:", err) + } + + _, err = _do.Select(verificationToken.ALL).Omit(primaryKey).Take() + if err != nil { + t.Error("Omit() on table fail:", err) + } + + _, err = _do.Group(primaryKey).Find() + if err != nil { + t.Error("Group() on table fail:", err) + } + + _, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find() + if err != nil { + t.Error("Scopes() on table fail:", err) + } + + _, _, err = _do.FindByPage(0, 1) + if err != nil { + t.Error("FindByPage() on table fail:", err) + } + + _, err = _do.ScanByPage(&model.VerificationToken{}, 0, 1) + if err != nil { + t.Error("ScanByPage() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit() + if err != nil { + t.Error("FirstOrInit() on table fail:", err) + } + + _, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate() + if err != nil { + t.Error("FirstOrCreate() on table fail:", err) + } + + var _a _another + var _aPK = field.NewString(_a.TableName(), "id") + + err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("Join() on table fail:", err) + } + + err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{}) + if err != nil { + t.Error("LeftJoin() on table fail:", err) + } + + _, err = _do.Not().Or().Clauses().Take() + if err != nil { + t.Error("Not/Or/Clauses on table fail:", err) + } +} diff --git a/pkg/session/go.mod b/pkg/session/go.mod new file mode 100644 index 0000000..c40a2fc --- /dev/null +++ b/pkg/session/go.mod @@ -0,0 +1,8 @@ +module session + +go 1.21.5 + +require ( + github.com/golang-jwt/jwt/v5 v5.2.0 + github.com/rs/zerolog v1.0.0 +) diff --git a/pkg/session/go.sum b/pkg/session/go.sum new file mode 100644 index 0000000..4f9555d --- /dev/null +++ b/pkg/session/go.sum @@ -0,0 +1,4 @@ +github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= +github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/rs/zerolog v1.0.0 h1:nyPrZaY4d0BlOTLz7F6eBx4GX7IuaszHwTAOnlK+BfQ= +github.com/rs/zerolog v1.0.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= diff --git a/pkg/session/token.go b/pkg/session/token.go new file mode 100644 index 0000000..e707843 --- /dev/null +++ b/pkg/session/token.go @@ -0,0 +1,178 @@ +package token + +import ( + "context" + "exception" + "fmt" + "net/http" + "os" + "strconv" + "time" + + jwt "github.com/golang-jwt/jwt/v5" + "github.com/rs/zerolog/log" +) + +const defaultSecret = "secret123" +const defaultAccessExpires = 24 * time.Hour +const defaultRefreshExpires = 7 * 24 * time.Hour + +var secret string +var baseURL string +var accessExpires time.Duration +var refreshExpires time.Duration + +func init() { + baseURL = os.Getenv("VITE_BASE_URL") + secret = os.Getenv("JWT_SECRET") + if secret == "" { + secret = defaultSecret + } + sec, err := strconv.ParseInt(os.Getenv("ACCESS_TOKEN_VALIDITY"), 10, 0) + if err != nil { + accessExpires = defaultAccessExpires + } else { + accessExpires = time.Duration(sec) * time.Millisecond + } + sec, err = strconv.ParseInt(os.Getenv("REFRESH_TOKEN_VALIDITY"), 10, 0) + if err != nil { + refreshExpires = defaultRefreshExpires + } else { + refreshExpires = time.Duration(sec) * time.Millisecond + } +} + +type Session struct { + Uid string + Sid string +} + +type ContextKey string + +func New(uid string, access bool) (string, error) { + now := time.Now().UnixMilli() + var exp int64 + if access { + exp = accessExpires.Milliseconds() + now + } else { + exp = refreshExpires.Milliseconds() + now + } + return jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "iss": baseURL, + "sub": uid, + "aud": []string{baseURL}, + "iat": now, + "exp": exp, + }).SignedString([]byte(secret)) +} + +// AuthMiddleware decodes the share session cookie and packs the logged user into context +func AuthMiddleware(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + defer func() { + // enableCors(&w) + next.ServeHTTP(w, r) + log.Info().TimeDiff("Duration", start, time.Now()).Msgf("%s [%s] %s in %v", r.RemoteAddr, r.Method, r.URL.Path, time.Since(start)) + }() + at, err := r.Cookie("access_token") + if err != nil || at == nil { + log.Error().Msgf("access_token not found: %v, %s", err, at) + return + } + rt, err := r.Cookie("refresh_token") + if err != nil || rt == nil { + log.Error().Msgf("refresh_token not found: %v, %s", err, rt) + return + } + var sidStr string + sid, err := r.Cookie("connect.sid") + if err == nil && sid != nil { + sidStr = sid.Value + } + ctx := r.Context() + if ctx == nil { + ctx = context.Background() + } + + // validate token + access, err := jwt.Parse(at.Value, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + return []byte(secret), nil + }) + if err != nil { + if err == jwt.ErrTokenExpired { + // access token expired, check Refersh token + _, err := jwt.Parse(rt.Value, func(t *jwt.Token) (interface{}, error) { + if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok { + return nil, fmt.Errorf("unexpected signing method: %v", t.Header["alg"]) + } + return []byte(secret), nil + }) + if err != nil { + switch err { + case jwt.ErrTokenExpired: + log.Error().Msgf("refresh token expired: %v", err) + ctx := context.WithValue(ctx, ContextKey("error"), exception.ErrTokenExpired) + r = r.WithContext(ctx) + return + default: + log.Error().Msgf("refresh token parse failed: %v", err) + ctx := context.WithValue(ctx, ContextKey("error"), exception.ErrInvalidRefreshToken) + r = r.WithContext(ctx) + return + } + } + if claims, ok := access.Claims.(jwt.MapClaims); ok { + // all good + uid, err := claims.GetSubject() + if err != nil { + log.Error().Msgf("get uid failed: %v", err) + ctx = context.WithValue(ctx, ContextKey("error"), err) + r = r.WithContext(ctx) + return + } + // refresh token is valid, get new access token + token, err := New(uid, true) + if err != nil { + log.Error().Msgf("refresh generate token failed: %v", err) + ctx = context.WithValue(ctx, ContextKey("error"), err) + r = r.WithContext(ctx) + return + } + access_cookie := http.Cookie{ + Name: "access_token", + Value: token, + Expires: time.Now().Add(accessExpires), + HttpOnly: true, + Secure: true, + SameSite: http.SameSiteLaxMode, + } + http.SetCookie(w, &access_cookie) + } + } + } + if claims, ok := access.Claims.(jwt.MapClaims); ok { + // all good + uid, err := claims.GetSubject() + if err != nil { + log.Error().Msgf("get uid failed: %v", err) + ctx = context.WithValue(ctx, ContextKey("error"), err) + } else { + log.Info().Msgf("uid: %v", uid) + ctx = context.WithValue(ctx, ContextKey("session"), Session{ + Uid: uid, + Sid: sidStr, + }) + } + r = r.WithContext(ctx) + return + } + // access token parse failed + log.Error().Msgf("invaild access token") + ctx = context.WithValue(ctx, ContextKey("error"), exception.ErrInvalidAccessToken) + r = r.WithContext(ctx) + }) +} diff --git a/template/team-invitation.html b/template/team-invitation.html new file mode 100644 index 0000000..31557a3 --- /dev/null +++ b/template/team-invitation.html @@ -0,0 +1,520 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/template/user-invitation.html b/template/user-invitation.html new file mode 100644 index 0000000..838fd59 --- /dev/null +++ b/template/user-invitation.html @@ -0,0 +1,526 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file