Skip to content

Commit

Permalink
Merge pull request #584 from bandada-infra/feat/onchain-group-invite
Browse files Browse the repository at this point in the history
Add on-chain group invites
  • Loading branch information
vplasencia authored Oct 31, 2024
2 parents 84a2d68 + 1ec5f62 commit 3a2f330
Show file tree
Hide file tree
Showing 22 changed files with 870 additions and 166 deletions.
12 changes: 6 additions & 6 deletions apps/api/src/app/credentials/credentials.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe("CredentialsService", () => {
it("Should throw an error if the credential group blockchain network is not supported", async () => {
const { id: _groupId } = await groupsService.createGroup(
{
name: "Group2",
name: "Group3",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down Expand Up @@ -233,7 +233,7 @@ describe("CredentialsService", () => {
it("Should add the same credential with different identities in different groups", async () => {
const { id: _groupId } = await groupsService.createGroup(
{
name: "Group2",
name: "Group4",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down Expand Up @@ -339,7 +339,7 @@ describe("CredentialsService", () => {
it("Should add a member to a credential group using the number of transactions", async () => {
const { id } = await groupsService.createGroup(
{
name: "Group2",
name: "Group5",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down Expand Up @@ -390,7 +390,7 @@ describe("CredentialsService", () => {
it("Should add a member to a group with many credentials", async () => {
const { id } = await groupsService.createGroup(
{
name: "Group3",
name: "Group6",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down Expand Up @@ -443,7 +443,7 @@ describe("CredentialsService", () => {
it("Should not add a member to a group with many credentials and return undefined if the OAuth state does not match the credential provider", async () => {
const { id: _groupId } = await groupsService.createGroup(
{
name: "Group4",
name: "Group7",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down Expand Up @@ -497,7 +497,7 @@ describe("CredentialsService", () => {
it("Should throw an error if the group with many credentials contains unsupported network", async () => {
const { id: _groupId } = await groupsService.createGroup(
{
name: "Group5",
name: "Group8",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
Expand Down
14 changes: 12 additions & 2 deletions apps/api/src/app/groups/groups.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { UpdateGroupsDto } from "./dto/update-groups.dto"
import { GroupsService } from "./groups.service"
import { mapGroupToResponseDTO } from "./groups.utils"
import { RemoveGroupsDto } from "./dto/remove-groups.dto"
import { GroupType } from "./types"

@ApiTags("groups")
@Controller("groups")
Expand All @@ -40,13 +41,22 @@ export class GroupsController {
@Get()
@ApiQuery({ name: "adminId", required: false, type: String })
@ApiQuery({ name: "memberId", required: false, type: String })
@ApiQuery({ name: "type", required: false, type: String })
@ApiQuery({ name: "name", required: false, type: String })
@ApiOperation({ description: "Returns the list of groups." })
@ApiCreatedResponse({ type: Group, isArray: true })
async getGroups(
@Query("adminId") adminId: string,
@Query("memberId") memberId: string
@Query("memberId") memberId: string,
@Query("type") type: GroupType,
@Query("name") name: string
) {
const groups = await this.groupsService.getGroups({ adminId, memberId })
const groups = await this.groupsService.getGroups({
adminId,
memberId,
type,
name
})
const groupIds = groups.map((group) => group.id)
const fingerprints = await this.groupsService.getFingerprints(groupIds)

Expand Down
Loading

0 comments on commit 3a2f330

Please sign in to comment.