Initial Phoenix Sankofa Cloud setup
- Complete project structure with Next.js frontend - GraphQL API backend with Apollo Server - Portal application with NextAuth - Crossplane Proxmox provider - GitOps configurations - CI/CD pipelines - Testing infrastructure (Vitest, Jest, Go tests) - Error handling and monitoring - Security hardening - UI component library - Documentation
This commit is contained in:
74
src/types/index.ts
Normal file
74
src/types/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Shared TypeScript type definitions
|
||||
*/
|
||||
|
||||
// API Types
|
||||
export interface Resource {
|
||||
id: string
|
||||
name: string
|
||||
type: ResourceType
|
||||
status: ResourceStatus
|
||||
site: Site
|
||||
metadata?: Record<string, unknown>
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface Site {
|
||||
id: string
|
||||
name: string
|
||||
region: string
|
||||
status: SiteStatus
|
||||
resources?: Resource[]
|
||||
metadata?: Record<string, unknown>
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string
|
||||
email: string
|
||||
name: string
|
||||
role: UserRole
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export type ResourceType = 'VM' | 'CONTAINER' | 'STORAGE' | 'NETWORK'
|
||||
export type ResourceStatus = 'PENDING' | 'PROVISIONING' | 'RUNNING' | 'STOPPED' | 'ERROR' | 'DELETING'
|
||||
export type SiteStatus = 'ACTIVE' | 'INACTIVE' | 'MAINTENANCE'
|
||||
export type UserRole = 'ADMIN' | 'USER' | 'VIEWER'
|
||||
|
||||
// Form Types
|
||||
export interface ResourceFormData {
|
||||
name: string
|
||||
type: ResourceType
|
||||
siteId: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
// API Response Types
|
||||
export interface ApiResponse<T> {
|
||||
data?: T
|
||||
errors?: Array<{
|
||||
message: string
|
||||
code?: string
|
||||
path?: string[]
|
||||
}>
|
||||
}
|
||||
|
||||
// Pagination Types
|
||||
export interface PaginationParams {
|
||||
page?: number
|
||||
limit?: number
|
||||
offset?: number
|
||||
}
|
||||
|
||||
export interface PaginatedResponse<T> {
|
||||
items: T[]
|
||||
total: number
|
||||
page: number
|
||||
limit: number
|
||||
hasMore: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user