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(api-sdk); add create associated group #590

Closed
wants to merge 11 commits into from
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
Loading
Loading