Seed route-ready team addresses
Build and deploy Docker image / build (push) Successful in 2m42s

This commit is contained in:
Ruslan Bakiev
2026-08-24 14:20:22 +07:00
parent ccdf536763
commit 6e6badc419
2 changed files with 75 additions and 0 deletions
+4
View File
@@ -2,6 +2,7 @@ import { GraphQLError } from 'graphql'
import { randomUUID, createHash } from 'crypto'
import { prisma } from '../db.js'
import { requireScopes, type AuthContext } from '../auth.js'
import { ensureDemoTeamAddresses } from '../demo-addresses.js'
import { materializeTeamFromContext } from '../team-materialization.js'
export const teamTypeDefs = `#graphql
@@ -155,6 +156,8 @@ export const teamResolvers = {
requireScopes(ctx, 'teams:member')
if (!ctx.teamUuid) throw new GraphQLError('Team UUID not found')
await materializeTeamFromContext(ctx)
const materializedTeam = await prisma.team.findUnique({ where: { uuid: ctx.teamUuid } })
if (materializedTeam) await ensureDemoTeamAddresses(materializedTeam.id, ctx.teamUuid)
const team = await getTeamByUuid(ctx.teamUuid)
return team ? mapTeam(team) : null
},
@@ -192,6 +195,7 @@ export const teamResolvers = {
await materializeTeamFromContext(ctx)
const team = await prisma.team.findUnique({ where: { uuid: ctx.teamUuid } })
if (!team) return []
await ensureDemoTeamAddresses(team.id, ctx.teamUuid)
const addrs = await prisma.teamAddress.findMany({ where: { teamId: team.id }, orderBy: { createdAt: 'desc' } })
return addrs.map(a => ({
uuid: a.uuid, name: a.name, address: a.address,