diff --git a/app/graphql/types/input/post/create.rb b/app/graphql/types/input/post/create.rb index f2ce81936..f22122780 100644 --- a/app/graphql/types/input/post/create.rb +++ b/app/graphql/types/input/post/create.rb @@ -7,6 +7,7 @@ class Types::Input::Post::Create < Types::Input::Base argument :is_nsfw, Boolean, required: false, default_value: false, as: :nsfw argument :spoiled_unit_id, ID, required: false argument :spoiled_unit_type, String, required: false + argument :target_user_id, ID, required: false def to_model to_h.merge({ user_id: current_user&.id }) diff --git a/app/graphql/types/post.rb b/app/graphql/types/post.rb index e8da4e219..fe3ce3475 100644 --- a/app/graphql/types/post.rb +++ b/app/graphql/types/post.rb @@ -80,4 +80,12 @@ def follows Loaders::RecordLoader.for(User, token: context[:token]).load_many(follows.pluck(:user_id)) end end + + field :target_profile, Types::Profile, + null: false, + description: 'The profile of the target user of the post.' + + def target_profile + Loaders::RecordLoader.for(User).load(object.target_user_id) + end end