Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 2 additions & 36 deletions apps/dashboard/lib/mock-data.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 7 additions & 3 deletions apps/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -27,4 +31,4 @@
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
}
46 changes: 46 additions & 0 deletions packages/integration-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions packages/integration-client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
}