debian-mirror-gitlab/app/graphql/types/member_interface.rb

42 lines
1.2 KiB
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
module Types
module MemberInterface
include BaseInterface
2020-11-24 15:15:51 +05:30
field :id, GraphQL::ID_TYPE, null: false,
2021-03-11 19:13:27 +05:30
description: 'ID of the member.'
2020-11-24 15:15:51 +05:30
2020-06-23 00:09:42 +05:30
field :access_level, Types::AccessLevelType, null: true,
2021-03-11 19:13:27 +05:30
description: 'GitLab::Access level.'
2020-06-23 00:09:42 +05:30
field :created_by, Types::UserType, null: true,
2021-03-11 19:13:27 +05:30
description: 'User that authorized membership.'
2020-06-23 00:09:42 +05:30
field :created_at, Types::TimeType, null: true,
2021-03-11 19:13:27 +05:30
description: 'Date and time the membership was created.'
2020-06-23 00:09:42 +05:30
field :updated_at, Types::TimeType, null: true,
2021-03-11 19:13:27 +05:30
description: 'Date and time the membership was last updated.'
2020-06-23 00:09:42 +05:30
field :expires_at, Types::TimeType, null: true,
2021-03-11 19:13:27 +05:30
description: 'Date and time the membership expires.'
2020-11-24 15:15:51 +05:30
2021-09-04 01:27:46 +05:30
field :user, Types::UserType, null: true,
2021-03-11 19:13:27 +05:30
description: 'User that is associated with the member object.'
2020-11-24 15:15:51 +05:30
definition_methods do
def resolve_type(object, context)
case object
when GroupMember
Types::GroupMemberType
when ProjectMember
Types::ProjectMemberType
else
raise ::Gitlab::Graphql::Errors::BaseError, "Unknown member type #{object.class.name}"
end
end
end
2020-06-23 00:09:42 +05:30
end
end