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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/xspace-agent/packages/core/src/db/repositories/marketplace-review.ts
overstepping2430561901d4
diff --git a/xspace-agent/xspace-agent/packages/core/src/db/repositories/marketplace-review.ts b/xspace-agent/xspace-agent/packages/core/src/db/repositories/marketplace-review.tsnew file mode 100644index 000000000..a720f16c5--- /dev/null+++ b/xspace-agent/xspace-agent/packages/core/src/db/repositories/marketplace-review.ts@@ -0,0 +1,89 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§32]++// =============================================================================+// Repository — Marketplace Reviews+// =============================================================================++import { eq, and, desc, avg, count, sql } from 'drizzle-orm'+import { getDatabase } from '../connection'+import { marketplaceReviews } from '../schema'++export type MarketplaceReview = typeof marketplaceReviews.$inferSelect+export type NewMarketplaceReview = typeof marketplaceReviews.$inferInsert++export class MarketplaceReviewRepository {+ private get db() {+ return getDatabase()+ }++ async create(data: NewMarketplaceReview): Promise<MarketplaceReview> {+ const [review] = await this.db.insert(marketplaceReviews).values(data).returning()+ return review+ }++ async findById(id: string): Promise<MarketplaceReview | undefined> {+ return this.db.query.marketplaceReviews.findFirst({+ where: eq(marketplaceReviews.id, id),+ })+ }++ async findByListing(listingId: string, limit = 50, offset = 0): Promise<MarketplaceReview[]> {+ return this.db.query.marketplaceReviews.findMany({+ where: eq(marketplaceReviews.listingId, listingId),+ orderBy: [desc(marketplaceReviews.createdAt)],+ limit,+ offset,+ })+ }++ async findByUserAndListing(userId: string, listingId: string): Promise<MarketplaceReview | undefined> {+ return this.db.query.marketplaceReviews.findFirst({+ where: and(+ eq(marketplaceReviews.userId, userId),+ eq(marketplaceReviews.listingId, listingId),+ ),+ })+ }++ /** Get aggregate rating stats for a listing. */+ async getListingStats(listingId: string): Promise<{ avg: number; count: number }> {+ const [result] = await this.db+ .select({+ avg: avg(marketplaceReviews.rating),+ count: count(),+ })+ .from(marketplaceReviews)+ .where(eq(marketplaceReviews.listingId, listingId))++ return {+ avg: Number(result?.avg ?? 0),+ count: Number(result?.count ?? 0),+ }+ }++ async update(+ id: string,+ data: Partial<Pick<MarketplaceReview, 'rating' | 'title' | 'body'>>,+ ): Promise<MarketplaceReview | undefined> {+ const [updated] = await this.db+ .update(marketplaceReviews)+ .set(data)+ .where(eq(marketplaceReviews.id, id))+ .returning()+ return updated+ }++ async incrementHelpful(id: string): Promise<void> {+ await this.db+ .update(marketplaceReviews)+ .set({ helpfulCount: sql`${marketplaceReviews.helpfulCount} + 1` })+ .where(eq(marketplaceReviews.id, id))+ }++ async delete(id: string): Promise<void> {+ await this.db.delete(marketplaceReviews).where(eq(marketplaceReviews.id, id))+ }+}++