Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: on-chain invites #608

Open
wants to merge 57 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d21d6e2
feat(api): add type to group to indicate group type
waddaboo Oct 17, 2024
90445fc
test(api): update test to include group type
waddaboo Oct 17, 2024
ef064b1
feat(api): update string enum to string literal
waddaboo Oct 17, 2024
13cfb79
test(api): update test for group type string literal
waddaboo Oct 17, 2024
2d52a3a
feat(api-sdk): add group type to api sdk
waddaboo Oct 18, 2024
9f0de74
docs(api-sdk): update group type api sdk docs
waddaboo Oct 18, 2024
e32fab4
fix(api-sdk): fix missing type in group type
waddaboo Oct 18, 2024
c728aba
fix(api): fix missing type in mapGroupToResponseDTO
waddaboo Oct 18, 2024
8ded485
feat(dashboard): add group type to dashboard
waddaboo Oct 18, 2024
d8531f0
feat(api): add get groups query by type
waddaboo Oct 23, 2024
b4663fc
feat(api): add getGroups filter by name
waddaboo Oct 24, 2024
f059b62
feat(dashboard): auto create associated group when creating on-chain …
waddaboo Oct 24, 2024
a32e31a
feat(dashboard): add getGroups filter by type; add getGroupByName
waddaboo Oct 24, 2024
61f069b
feat(dashboard): add getAssociatedGroup for dashboard
waddaboo Oct 24, 2024
d7b03e2
feat(dashboard): enable generateInviteLink to on-chain groups
waddaboo Oct 24, 2024
033d585
refactor(dashboard): refactor getAssociatedGroup
waddaboo Oct 24, 2024
ebdd85d
feat(dashboard): add remove on-chain/associated group member
waddaboo Oct 24, 2024
0f61e14
feat(dashboard): add group type to getGroupByName
waddaboo Oct 24, 2024
7df148c
Merge branch 'dev' into feat/onchain-group-invite
waddaboo Oct 24, 2024
f29b4b9
test(api,api-sdk): fix test
waddaboo Oct 24, 2024
916e3f4
feat(api-sdk): add get groups by type, name, and associated groups
waddaboo Oct 24, 2024
78b92e1
docs(api-sdk): update docs for new api-sdk
waddaboo Oct 24, 2024
8f4285d
Merge pull request #581 from bandada-infra/feat/group-types
vplasencia Oct 27, 2024
84a2d68
feat(database): update database seed group property
waddaboo Oct 28, 2024
813d0dd
Merge remote-tracking branch 'origin/feat/on-chain-invites' into feat…
waddaboo Oct 28, 2024
2e98c2d
test(api-sdk): fix test to match new apisdk constant
waddaboo Oct 28, 2024
0fa239d
feat(api-sdk): add create associated group
waddaboo Oct 29, 2024
89920d8
style(api-sdk): prettier fix
waddaboo Oct 29, 2024
37f8a07
docs(api-sdk): add create associated group to docs
waddaboo Oct 29, 2024
1316296
Merge pull request #591 from bandada-infra/feat/api-sdk/create-associ…
vplasencia Oct 30, 2024
122f64c
feat(dashboard): add auto create associated group if not found
waddaboo Oct 30, 2024
329a3f8
feat(api): add unique group name with adminId check when creating group
waddaboo Oct 30, 2024
98963df
test(api): fix test fail due to unique group name check
waddaboo Oct 30, 2024
eb9355b
test(api): add unique group name test
waddaboo Oct 30, 2024
cfa80d7
refactor(client): move bandadaAPI from util to api folder
waddaboo Oct 31, 2024
ddce332
feat(client): add get semaphore group
waddaboo Oct 31, 2024
6bc62c9
feat(client): add onchain join group by invite code
waddaboo Oct 31, 2024
1ec5f62
feat(dashboard): remove get associated group, no longer needed
waddaboo Oct 31, 2024
3a2f330
Merge pull request #584 from bandada-infra/feat/onchain-group-invite
vplasencia Oct 31, 2024
41a2797
feat(api): enable redeemInvite in controller
waddaboo Oct 31, 2024
924b483
feat(api-sdk): add redeemInvite
waddaboo Oct 31, 2024
729d358
feat(client): add redeemInvite for on-chain join group by invite
waddaboo Oct 31, 2024
8252226
feat(api): add redeem invite with api key and manually
waddaboo Nov 1, 2024
8149fd5
feat(api): add security to redeem invite endpoint
waddaboo Nov 1, 2024
d3a05fa
feat(api-sdk): add redeem invite api key
waddaboo Nov 1, 2024
720b76e
feat(client): update redeem invite
waddaboo Nov 1, 2024
ebbf4d6
refactor(api): update redeemInvite method, move param to body
waddaboo Nov 1, 2024
6cd256f
refactor(api-sdk): update redeemInvite method and body
waddaboo Nov 1, 2024
0f3a763
Merge pull request #595 from bandada-infra/feat/api-sdk/redeem-invite
vplasencia Nov 1, 2024
e4c4c75
feat(api): add invite code validity check
waddaboo Nov 4, 2024
38457e3
feat(api-sdk): add invite code validity check
waddaboo Nov 4, 2024
8e9dd3d
feat(client): add invite code validity check
waddaboo Nov 4, 2024
a978e98
docs(api-sdk): add checkInvite docs
waddaboo Nov 4, 2024
02f6a93
docs: add checkInvite docs
waddaboo Nov 4, 2024
f83fd6b
docs: add redeemInvite docs
waddaboo Nov 4, 2024
23d3cc6
Merge pull request #600 from bandada-infra/feat/check-invite
vplasencia Nov 22, 2024
8f0ddaf
Merge branch 'dev' into feat/on-chain-invites
waddaboo Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions apps/api/src/app/credentials/credentials.service.test.ts
Original file line number Diff line number Diff line change
@@ -83,6 +83,7 @@ describe("CredentialsService", () => {
{
name: "Group1",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -104,6 +105,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600
},
@@ -184,8 +186,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -230,8 +233,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -335,8 +339,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -385,8 +390,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -437,8 +443,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
@@ -490,8 +497,9 @@ 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,
fingerprintDuration: 3600,
credentials: JSON.stringify({
2 changes: 2 additions & 0 deletions apps/api/src/app/groups/docSchemas/group.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ export class Group {
@ApiProperty()
description: string
@ApiProperty()
type: string
@ApiProperty()
admin: string
@ApiProperty()
treeDepth: number
2 changes: 2 additions & 0 deletions apps/api/src/app/groups/docSchemas/groupResponse.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ export class GroupResponse {
@ApiProperty()
description: string
@ApiProperty()
type: string
@ApiProperty()
adminId: string
@ApiProperty()
treeDepth: number
10 changes: 9 additions & 1 deletion apps/api/src/app/groups/dto/create-group.dto.ts
Original file line number Diff line number Diff line change
@@ -8,9 +8,11 @@ import {
MinLength,
NotContains,
IsNumberString,
IsJSON
IsJSON,
IsEnum
} from "class-validator"
import { ApiProperty } from "@nestjs/swagger"
import { GroupType } from "../types"

export class CreateGroupDto {
@IsString()
@@ -30,6 +32,12 @@ export class CreateGroupDto {
@ApiProperty()
readonly description: string

@IsEnum(["on-chain", "off-chain"])
@ApiProperty({
enum: ["on-chain", "off-chain"]
})
readonly type: GroupType

@IsNumber()
@Min(16, { message: "The tree depth must be between 16 and 32." })
@Max(32, { message: "The tree depth must be between 16 and 32." })
8 changes: 8 additions & 0 deletions apps/api/src/app/groups/entities/group.entity.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import {
import { OAuthAccount } from "../../credentials/entities/credentials-account.entity"
import { Member } from "./member.entity"
import { Invite } from "../../invites/entities/invite.entity"
import { GroupType } from "../types"

@Entity("groups")
export class Group {
@@ -25,6 +26,13 @@ export class Group {
@Column()
description: string

@Column({
type: "simple-enum",
enum: ["on-chain", "off-chain"],
nullable: true
})
type: GroupType

@Column({ name: "admin_id" })
adminId: string

14 changes: 12 additions & 2 deletions apps/api/src/app/groups/groups.controller.ts
Original file line number Diff line number Diff line change
@@ -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")
@@ -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)

Loading