From bdfabf8a01ca89be8e1f1aaeb90fa567bf05da9a Mon Sep 17 00:00:00 2001 From: IHUOMA NKECHI BRIDGET Date: Wed, 29 Jul 2026 16:23:59 +0100 Subject: [PATCH] Consolidate dashboard domain types in integration client --- apps/dashboard/lib/mock-data.ts | 38 +------------------ apps/dashboard/tsconfig.json | 10 +++-- packages/integration-client/README.md | 46 +++++++++++++++++++++++ packages/integration-client/tsconfig.json | 7 ++-- 4 files changed, 58 insertions(+), 43 deletions(-) diff --git a/apps/dashboard/lib/mock-data.ts b/apps/dashboard/lib/mock-data.ts index 43c7f28..2138844 100644 --- a/apps/dashboard/lib/mock-data.ts +++ b/apps/dashboard/lib/mock-data.ts @@ -1,43 +1,9 @@ -import type { ActivityChange, ActivityEvent } from "@guildpass/integration-client"; +import type { ActivityChange, ActivityEvent, Guild, Member, Pass } from "@guildpass/integration-client"; import type { ActivityQuery } from "./activity/query"; import { readApiResult } from "./api-client"; import { GUILD_ID_HEADER } from "./guild-context"; -export interface Pass { - id: string; - /** Owning guild (tenant). Every pass belongs to exactly one guild. */ - guildId: string; - name: string; - description: string; - status: "active" | "inactive" | "draft"; - price?: number; - maxSupply?: number | null; - currentSupply: number; - createdAt: string; -} - -export interface Guild { - id: string; - name: string; - description: string; - memberCount: number; - passCount: number; - createdAt: string; -} - -export interface Member { - id: string; - /** Owning guild (tenant). Every member record belongs to exactly one guild. */ - guildId: string; - wallet: string; - name: string; - status: "active" | "inactive" | "pending"; - roles: string[]; - joinedAt: string; - lastActive: string; - /** Monotonically increasing version number for optimistic concurrency control. */ - version: number; -} +export type { Guild, Member, Pass }; export interface Activity { id: string; diff --git a/apps/dashboard/tsconfig.json b/apps/dashboard/tsconfig.json index 566a6d2..3522473 100644 --- a/apps/dashboard/tsconfig.json +++ b/apps/dashboard/tsconfig.json @@ -15,9 +15,13 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, - "plugins": [{"name": "next"}], + "plugins": [ + { + "name": "next" + } + ], "baseUrl": ".", - "ignoreDeprecations": "6.0", + "ignoreDeprecations": "5.0", "paths": { "@/*": ["./*"], "@guildpass/env": ["../../packages/env/src/index.ts"], @@ -27,4 +31,4 @@ }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] -} +} \ No newline at end of file diff --git a/packages/integration-client/README.md b/packages/integration-client/README.md index d9caf83..1b08ba8 100644 --- a/packages/integration-client/README.md +++ b/packages/integration-client/README.md @@ -205,6 +205,52 @@ import { } from "@guildpass/integration-client"; ``` +## Shared domain types + +`Pass`, `Guild`, and `Member` are the canonical shapes for these entities, +shared between `apps/dashboard` and `apps/discord-bot` so the two apps can't +drift apart: + +```ts +import type { Pass, Guild, Member } from "@guildpass/integration-client"; + +type Pass = { + id: string; + guildId: string; + name: string; + description: string; + status: "active" | "inactive" | "draft"; + price?: number; + maxSupply?: number | null; + currentSupply: number; + createdAt: string; +}; + +type Guild = { + id: string; + name: string; + description: string; + memberCount: number; + passCount: number; + createdAt: string; +}; + +type Member = { + id: string; + guildId: string; + wallet: string; + name: string; + status: "active" | "inactive" | "pending"; + roles: string[]; + joinedAt: string; + lastActive: string; + version: number; // optimistic concurrency control +}; +``` + +The audit/event equivalent is `ActivityEvent` (see below), which models a +single logged activity item rather than a core entity. + ## ActivityEvent schema versioning `ActivityEvent` carries an explicit `schemaVersion` field so that historical diff --git a/packages/integration-client/tsconfig.json b/packages/integration-client/tsconfig.json index 7a4a979..e25757b 100644 --- a/packages/integration-client/tsconfig.json +++ b/packages/integration-client/tsconfig.json @@ -2,11 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "baseUrl": ".", - "ignoreDeprecations": "6.0", + "ignoreDeprecations": "5.0", "rootDir": "src", "outDir": "dist", - "composite": false, - + "composite": false }, "include": ["src"] -} +} \ No newline at end of file