chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -31,6 +31,7 @@ import * as apiMarketplaceService from '../services/api-marketplace'
|
||||
import * as analyticsService from '../services/analytics'
|
||||
import * as aiOptimizationService from '../services/ai-optimization'
|
||||
import { infrastructureResolvers } from '../resolvers/infrastructure'
|
||||
import { operatingModelService } from '../services/operating-model.js'
|
||||
import {
|
||||
createTenantInputSchema,
|
||||
updateTenantInputSchema,
|
||||
@@ -199,6 +200,39 @@ export const resolvers = {
|
||||
return tenantService.getTenant(context.tenantContext.tenantId)
|
||||
},
|
||||
|
||||
myClient: async (_: unknown, __: unknown, context: Context) => {
|
||||
if (!context.user) {
|
||||
throw new GraphQLError('Authentication required', {
|
||||
extensions: { code: 'UNAUTHENTICATED' },
|
||||
})
|
||||
}
|
||||
const tenantId = context.tenantContext?.tenantId
|
||||
if (!tenantId) return null
|
||||
return operatingModelService.getClientByTenantId(tenantId)
|
||||
},
|
||||
|
||||
mySubscriptions: async (_: unknown, __: unknown, context: Context) => {
|
||||
if (!context.user) {
|
||||
throw new GraphQLError('Authentication required', {
|
||||
extensions: { code: 'UNAUTHENTICATED' },
|
||||
})
|
||||
}
|
||||
const tenantId = context.tenantContext?.tenantId
|
||||
if (!tenantId) return []
|
||||
return operatingModelService.listSubscriptions({ tenantId })
|
||||
},
|
||||
|
||||
myEntitlements: async (_: unknown, __: unknown, context: Context) => {
|
||||
if (!context.user) {
|
||||
throw new GraphQLError('Authentication required', {
|
||||
extensions: { code: 'UNAUTHENTICATED' },
|
||||
})
|
||||
}
|
||||
const tenantId = context.tenantContext?.tenantId
|
||||
if (!tenantId) return []
|
||||
return operatingModelService.listEntitlements({ tenantId })
|
||||
},
|
||||
|
||||
tenantUsage: async (
|
||||
_: unknown,
|
||||
args: { tenantId: string; timeRange: TimeRange },
|
||||
|
||||
@@ -6,7 +6,7 @@ export const typeDefs = gql`
|
||||
|
||||
type Query {
|
||||
# Health check
|
||||
health: HealthStatus
|
||||
health: ApiHealthStatus
|
||||
|
||||
# Resources
|
||||
resources(filter: ResourceFilter): [Resource!]!
|
||||
@@ -73,6 +73,9 @@ export const typeDefs = gql`
|
||||
tenant(id: ID!): Tenant
|
||||
tenantByDomain(domain: String!): Tenant
|
||||
myTenant: Tenant
|
||||
myClient: OperatingClient
|
||||
mySubscriptions: [OperatingSubscription!]!
|
||||
myEntitlements: [OperatingEntitlement!]!
|
||||
tenantUsage(tenantId: ID!, timeRange: TimeRangeInput!): UsageReport!
|
||||
|
||||
# Billing (Superior to Azure Cost Management)
|
||||
@@ -310,7 +313,47 @@ export const typeDefs = gql`
|
||||
resourceDeleted(id: ID!): ID!
|
||||
}
|
||||
|
||||
type HealthStatus {
|
||||
type OperatingClient {
|
||||
id: ID!
|
||||
name: String!
|
||||
primaryDomain: String
|
||||
status: String!
|
||||
metadata: JSON
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type OperatingSubscription {
|
||||
id: ID!
|
||||
clientId: ID!
|
||||
tenantId: ID
|
||||
offerCode: String!
|
||||
offerName: String!
|
||||
offerType: String!
|
||||
commercialModel: String!
|
||||
supportOwner: String!
|
||||
fulfillmentMode: String!
|
||||
billingMode: String!
|
||||
status: String!
|
||||
activatedAt: DateTime
|
||||
metadata: JSON
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type OperatingEntitlement {
|
||||
id: ID!
|
||||
subscriptionId: ID!
|
||||
tenantId: ID
|
||||
entitlementKey: String!
|
||||
status: String!
|
||||
scope: JSON
|
||||
metadata: JSON
|
||||
createdAt: DateTime!
|
||||
updatedAt: DateTime!
|
||||
}
|
||||
|
||||
type ApiHealthStatus {
|
||||
status: String!
|
||||
timestamp: DateTime!
|
||||
version: String!
|
||||
@@ -660,7 +703,7 @@ export const typeDefs = gql`
|
||||
end: DateTime!
|
||||
}
|
||||
|
||||
enum HealthStatus {
|
||||
enum ComponentHealthLevel {
|
||||
HEALTHY
|
||||
DEGRADED
|
||||
UNHEALTHY
|
||||
|
||||
Reference in New Issue
Block a user