Skip to content

Commit

Permalink
feat: add getProfilesByUser query
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavaparoksham committed Feb 6, 2024
1 parent 14b6c47 commit 1a6cf2b
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions packages/data-layer/src/queries.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql } from "graphql-request";

/**
* Get all the programs that a user is a part of
* @param $alloVersion - The version of Allo
* Get all the programs that a user is a part of in allo v1
* @param $address - The address of the user
* @param $chainId - The network ID of the chain
*
Expand Down Expand Up @@ -31,6 +30,37 @@ export const getProgramsByUser = gql`
}
`;

/**
* Get all the profiles that a user is a part of in allo v2
* @param $alloVersion - The version of Allo
* @param $address - The address of the user
* @param $chainId - The network ID of the chain
*
* @returns The programs
*/
export const getProfilesByUser = gql`
query ($address: String!, $chainId: Int!) {
projects(
filter: {
tags: { contains: "allo-v2" }
roles: { some: { address: { equalTo: $address } } }
and: { chainId: { equalTo: $chainId } }
}
) {
id
chainId
metadata
metadataCid
tags
roles {
address
role
createdAtBlock
}
}
}
`;

/**
* Get a program by its programId
* @param $alloVersion - The version of Allo
Expand Down

0 comments on commit 1a6cf2b

Please sign in to comment.