Skip to content

Commit

Permalink
Client changes for Adding GraphQL Scalars (#511)
Browse files Browse the repository at this point in the history
* Change typedefs

* Fix date parsing

* Move ID to ObjectID scalar

* Revert ObjectID to ID

* Change ObjectID to ID
  • Loading branch information
EshaanAgg authored Feb 26, 2023
1 parent d393276 commit b36bb63
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 42 deletions.
52 changes: 23 additions & 29 deletions src/GraphQl/Mutations/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gql from 'graphql-tag';
// to unblock the user

export const UNBLOCK_USER_MUTATION = gql`
mutation UnblockUser($userId: ObjectID!, $orgId: ObjectID!) {
mutation UnblockUser($userId: ID!, $orgId: ID!) {
unblockUser(organizationId: $orgId, userId: $userId) {
_id
}
Expand All @@ -15,7 +15,7 @@ export const UNBLOCK_USER_MUTATION = gql`
// to block the user

export const BLOCK_USER_MUTATION = gql`
mutation BlockUser($userId: ObjectID!, $orgId: ObjectID!) {
mutation BlockUser($userId: ID!, $orgId: ID!) {
blockUser(organizationId: $orgId, userId: $userId) {
_id
}
Expand All @@ -25,7 +25,7 @@ export const BLOCK_USER_MUTATION = gql`
// to reject the organization request

export const REJECT_ORGANIZATION_REQUEST_MUTATION = gql`
mutation RejectMembershipRequest($id: ObjectID!) {
mutation RejectMembershipRequest($id: ID!) {
rejectMembershipRequest(membershipRequestId: $id) {
_id
}
Expand All @@ -35,7 +35,7 @@ export const REJECT_ORGANIZATION_REQUEST_MUTATION = gql`
// to accept the organization request

export const ACCEPT_ORGANIZATION_REQUEST_MUTATION = gql`
mutation AcceptMembershipRequest($id: ObjectID!) {
mutation AcceptMembershipRequest($id: ID!) {
acceptMembershipRequest(membershipRequestId: $id) {
_id
}
Expand All @@ -46,7 +46,7 @@ export const ACCEPT_ORGANIZATION_REQUEST_MUTATION = gql`

export const UPDATE_ORGANIZATION_MUTATION = gql`
mutation UpdateOrganization(
$id: ObjectID!
$id: ID!
$name: String
$description: String
$isPublic: Boolean
Expand Down Expand Up @@ -161,7 +161,7 @@ export const CREATE_ORGANIZATION_MUTATION = gql`
// to delete the organization

export const DELETE_ORGANIZATION_MUTATION = gql`
mutation RemoveOrganization($id: ObjectID!) {
mutation RemoveOrganization($id: ID!) {
removeOrganization(id: $id) {
_id
}
Expand All @@ -177,7 +177,7 @@ export const CREATE_EVENT_MUTATION = gql`
$recurring: Boolean!
$isPublic: Boolean!
$isRegisterable: Boolean!
$organizationId: ObjectID!
$organizationId: ID!
$startDate: Date!
$endDate: Date
$allDay: Boolean!
Expand Down Expand Up @@ -209,7 +209,7 @@ export const CREATE_EVENT_MUTATION = gql`
// to delete any event by any organization

export const DELETE_EVENT_MUTATION = gql`
mutation RemoveEvent($id: ObjectID!) {
mutation RemoveEvent($id: ID!) {
removeEvent(id: $id) {
_id
}
Expand All @@ -219,7 +219,7 @@ export const DELETE_EVENT_MUTATION = gql`
// to remove an admin from an organization

export const REMOVE_ADMIN_MUTATION = gql`
mutation RemoveAdmin($orgid: ObjectID!, $userid: ObjectID!) {
mutation RemoveAdmin($orgid: ID!, $userid: ID!) {
removeAdmin(data: { organizationId: $orgid, userId: $userid }) {
_id
}
Expand All @@ -229,7 +229,7 @@ export const REMOVE_ADMIN_MUTATION = gql`
// to Remove member from an organization

export const REMOVE_MEMBER_MUTATION = gql`
mutation RemoveMember($orgid: ObjectID!, $userid: ObjectID!) {
mutation RemoveMember($orgid: ID!, $userid: ID!) {
removeMember(data: { organizationId: $orgid, userId: $userid }) {
_id
}
Expand All @@ -239,7 +239,7 @@ export const REMOVE_MEMBER_MUTATION = gql`
// to add the admin

export const ADD_ADMIN_MUTATION = gql`
mutation CreateAdmin($orgid: ObjectID!, $userid: ObjectID!) {
mutation CreateAdmin($orgid: ID!, $userid: ID!) {
createAdmin(data: { organizationId: $orgid, userId: $userid }) {
_id
}
Expand All @@ -252,7 +252,7 @@ export const CREATE_POST_MUTATION = gql`
$title: String!
$imageUrl: URL
$videoUrl: URL
$organizationId: ObjectID!
$organizationId: ID!
) {
createPost(
data: {
Expand All @@ -269,7 +269,7 @@ export const CREATE_POST_MUTATION = gql`
`;

export const DELETE_POST_MUTATION = gql`
mutation RemovePost($id: ObjectID!) {
mutation RemovePost($id: ID!) {
removePost(id: $id) {
_id
}
Expand Down Expand Up @@ -301,19 +301,19 @@ export const FORGOT_PASSWORD_MUTATION = gql`
`;

export const UPDATE_USERTYPE_MUTATION = gql`
mutation UpdateUserType($id: ObjectID!, $userType: String!) {
mutation UpdateUserType($id: ID!, $userType: String!) {
updateUserType(data: { id: $id, userType: $userType })
}
`;

export const ACCPET_ADMIN_MUTATION = gql`
mutation AcceptAdmin($id: ObjectID!) {
mutation AcceptAdmin($id: ID!) {
acceptAdmin(id: $id)
}
`;

export const REJECT_ADMIN_MUTATION = gql`
mutation RejectAdmin($id: ObjectID!) {
mutation RejectAdmin($id: ID!) {
rejectAdmin(id: $id)
}
`;
Expand All @@ -323,10 +323,7 @@ export const REJECT_ADMIN_MUTATION = gql`
* @description used to toggle `installStatus` (boolean value) of a Plugin
*/
export const UPDATE_INSTALL_STATUS_PLUGIN_MUTATION = gql`
mutation update_install_status_plugin_mutation(
$id: ObjectID!
$status: Boolean!
) {
mutation update_install_status_plugin_mutation($id: ID!, $status: Boolean!) {
updateTempPluginStatus(id: $id, status: $status) {
_id
pluginName
Expand All @@ -342,10 +339,7 @@ export const UPDATE_INSTALL_STATUS_PLUGIN_MUTATION = gql`
* @description used `updateTempPluginInstalledOrgs`to add or remove the current Organization the in the plugin list `installedOrgs`
*/
export const UPDATE_ORG_STATUS_PLUGIN_MUTATION = gql`
mutation update_install_status_plugin_mutation(
$id: ObjectID!
$orgId: ObjectID!
) {
mutation update_install_status_plugin_mutation($id: ID!, $orgId: ID!) {
updateTempPluginInstalledOrgs(id: $id, orgId: $orgId) {
_id
pluginName
Expand All @@ -367,7 +361,7 @@ export const ADD_PLUGIN_MUTATION = gql`
$pluginCreatedBy: String!
$pluginDesc: String!
$pluginInstallStatus: Boolean!
$installedOrgs: [ObjectID!]
$installedOrgs: [ID!]
) {
createPlugin(
pluginName: $pluginName
Expand All @@ -387,7 +381,7 @@ export const ADD_PLUGIN_MUTATION = gql`
`;

export const UPDATE_POST_MUTATION = gql`
mutation UpdatePost($id: ObjectID!, $title: String, $text: String) {
mutation UpdatePost($id: ID!, $title: String, $text: String) {
updatePost(id: $id, data: { title: $title, text: $text }) {
_id
}
Expand All @@ -396,7 +390,7 @@ export const UPDATE_POST_MUTATION = gql`

export const UPDATE_EVENT_MUTATION = gql`
mutation UpdateEvent(
$id: ObjectID!
$id: ID!
$title: String!
$description: String!
$recurring: Boolean!
Expand Down Expand Up @@ -428,8 +422,8 @@ export const UPDATE_EVENT_MUTATION = gql`

export const UPDATE_SPAM_NOTIFICATION_MUTATION = gql`
mutation UpdateSpamNotification(
$orgId: ObjectID!
$spamId: ObjectID!
$orgId: ID!
$spamId: ID!
$isReaded: Boolean
) {
updateSpamNotification(
Expand Down
26 changes: 13 additions & 13 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const USER_LIST = gql`
// Query to take the Organization with data

export const ORGANIZATIONS_LIST = gql`
query Organizations($id: ObjectID!) {
query Organizations($id: ID!) {
organizations(id: $id) {
_id
image
Expand Down Expand Up @@ -133,7 +133,7 @@ export const ORGANIZATIONS_LIST = gql`
// Query to take the Members of a particular organization

export const MEMBERS_LIST = gql`
query Organizations($id: ObjectID!) {
query Organizations($id: ID!) {
organizations(id: $id) {
_id
members {
Expand All @@ -151,9 +151,9 @@ export const MEMBERS_LIST = gql`
// Query to filter out all the members with the macthing query and a particular OrgId
export const ORGANIZATIONS_MEMBER_CONNECTION_LIST = gql`
query Organizations(
$orgId: ObjectID!
$orgId: ID!
$firstName_contains: String
$admin_for: ObjectID
$admin_for: ID
$event_title_contains: String
) {
organizationsMemberConnection(
Expand All @@ -178,7 +178,7 @@ export const ORGANIZATIONS_MEMBER_CONNECTION_LIST = gql`

// To take the list of the oranization joined by a user
export const USER_ORGANIZATION_LIST = gql`
query User($id: ObjectID!) {
query User($id: ID!) {
user(id: $id) {
firstName
lastName
Expand All @@ -196,7 +196,7 @@ export const USER_ORGANIZATION_LIST = gql`

// to take the organization event list
export const ORGANIZATION_EVENT_LIST = gql`
query EventsByOrganization($id: ObjectID!) {
query EventsByOrganization($id: ID!) {
eventsByOrganization(id: $id) {
_id
title
Expand All @@ -216,7 +216,7 @@ export const ORGANIZATION_EVENT_LIST = gql`

export const ORGANIZATION_EVENT_CONNECTION_LIST = gql`
query EventsByOrganizationConnection(
$organization_id: ObjectID!
$organization_id: ID!
$title_contains: String
$description_contains: String
$location_contains: String
Expand Down Expand Up @@ -247,8 +247,8 @@ export const ORGANIZATION_EVENT_CONNECTION_LIST = gql`

export const ORGANIZATION_DONATION_CONNECTION_LIST = gql`
query GetDonationByOrgIdConnection(
$orgId: ObjectID!
$id: ObjectID
$orgId: ID!
$id: ID
$name_of_user_contains: String
) {
getDonationByOrgIdConnection(
Expand All @@ -267,7 +267,7 @@ export const ORGANIZATION_DONATION_CONNECTION_LIST = gql`
// to take the list of the admins of a particular

export const ADMIN_LIST = gql`
query Organizations($id: ObjectID!) {
query Organizations($id: ID!) {
organizations(id: $id) {
_id
admins {
Expand All @@ -285,7 +285,7 @@ export const ADMIN_LIST = gql`
// to take the membership request

export const MEMBERSHIP_REQUEST = gql`
query Organizations($id: ObjectID!) {
query Organizations($id: ID!) {
organizations(id: $id) {
_id
membershipRequests {
Expand All @@ -304,7 +304,7 @@ export const MEMBERSHIP_REQUEST = gql`
// display posts

export const ORGANIZATION_POST_LIST = gql`
query PostsByOrganization($id: ObjectID!) {
query PostsByOrganization($id: ID!) {
postsByOrganization(id: $id) {
_id
title
Expand All @@ -323,7 +323,7 @@ export const ORGANIZATION_POST_LIST = gql`

export const ORGANIZATION_POST_CONNECTION_LIST = gql`
query PostsByOrganizationConnection(
$id: ObjectID!
$id: ID!
$title_contains: String
$text_contains: String
) {
Expand Down

0 comments on commit b36bb63

Please sign in to comment.