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

Add on-chain group invites #584

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
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
8 changes: 8 additions & 0 deletions apps/api/src/app/credentials/credentials.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe("CredentialsService", () => {
{
name: "Group1",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand All @@ -104,6 +105,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600
},
Expand Down Expand Up @@ -186,6 +188,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down Expand Up @@ -232,6 +235,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down Expand Up @@ -337,6 +341,7 @@ describe("CredentialsService", () => {
{
name: "Group2",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down Expand Up @@ -387,6 +392,7 @@ describe("CredentialsService", () => {
{
name: "Group3",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down Expand Up @@ -439,6 +445,7 @@ describe("CredentialsService", () => {
{
name: "Group4",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down Expand Up @@ -492,6 +499,7 @@ describe("CredentialsService", () => {
{
name: "Group5",
description: "This is a description",
type: "off-chain",
treeDepth: 16,
fingerprintDuration: 3600,
credentials: JSON.stringify({
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/groups/docSchemas/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export class Group {
@ApiProperty()
description: string
@ApiProperty()
type: string
@ApiProperty()
admin: string
@ApiProperty()
treeDepth: number
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/app/groups/docSchemas/groupResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export class GroupResponse {
@ApiProperty()
description: string
@ApiProperty()
type: string
@ApiProperty()
adminId: string
@ApiProperty()
treeDepth: number
Expand Down
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
Expand Up @@ -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()
Expand All @@ -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." })
Expand Down
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
Expand Up @@ -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 {
Expand All @@ -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

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
Loading