Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/packages/core/src/db/repositories/team.ts

overstepping3d92693f5485
diff --git a/xspace-agent/packages/core/src/db/repositories/team.ts b/xspace-agent/packages/core/src/db/repositories/team.ts
new file mode 100644
index 000000000..b9f1a045d
--- /dev/null
+++ b/xspace-agent/packages/core/src/db/repositories/team.ts
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§32]
+
+// =============================================================================
+// Repository — Teams
+// =============================================================================
+
+import { eq } from 'drizzle-orm'
+import { getDatabase } from '../connection'
+import { teams } from '../schema'
+
+export type TeamRow = typeof teams.$inferSelect
+export type NewTeam = typeof teams.$inferInsert
+
+export class TeamRepository {
+ private get db() {
+ return getDatabase()
+ }
+
+ async create(data: NewTeam): Promise<TeamRow> {
+ const [team] = await this.db.insert(teams).values(data).returning()
+ return team
+ }
+
+ async findById(id: string): Promise<TeamRow | undefined> {
+ return this.db.query.teams.findFirst({
+ where: eq(teams.id, id),
+ })
+ }
+
+ async findByOrgId(orgId: string): Promise<TeamRow[]> {
+ return this.db.query.teams.findMany({
+ where: eq(teams.orgId, orgId),
+ })
+ }
+
+ async update(
+ id: string,
+ data: Partial<Pick<NewTeam, 'name' | 'description' | 'memberIds'>>,
+ ): Promise<TeamRow | undefined> {
+ const [team] = await this.db
+ .update(teams)
+ .set(data)
+ .where(eq(teams.id, id))
+ .returning()
+ return team
+ }
+
+ async delete(id: string): Promise<void> {
+ await this.db.delete(teams).where(eq(teams.id, id))
+ }
+}
+
+