openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Student GitHub Activity Tracker API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: students description: Student management - name: activity description: GitHub activity data - name: leaderboard description: Rankings and leaderboards - name: stats description: Dashboard statistics - name: batches description: Batch comparisons - name: sync description: GitHub data sync operations - name: insights description: AI-powered student insights paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /students: get: operationId: listStudents tags: [students] summary: List all students parameters: - name: batch in: query schema: type: string - name: active in: query schema: type: boolean responses: "200": description: List of students content: application/json: schema: type: array items: $ref: "#/components/schemas/Student" post: operationId: createStudent tags: [students] summary: Add a student requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateStudentBody" responses: "201": description: Created student content: application/json: schema: $ref: "#/components/schemas/Student" /students/{username}: get: operationId: getStudent tags: [students] summary: Get student profile with full stats parameters: - name: username in: path required: true schema: type: string responses: "200": description: Student profile content: application/json: schema: $ref: "#/components/schemas/StudentProfile" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: deleteStudent tags: [students] summary: Remove a student parameters: - name: username in: path required: true schema: type: string responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /students/{username}/activity: get: operationId: getStudentActivity tags: [activity] summary: Get daily activity history for a student parameters: - name: username in: path required: true schema: type: string - name: days in: query schema: type: integer default: 30 responses: "200": description: Activity records content: application/json: schema: type: array items: $ref: "#/components/schemas/DailyActivity" /students/{username}/sync: post: operationId: syncStudent tags: [sync] summary: Manually trigger GitHub data sync for a student parameters: - name: username in: path required: true schema: type: string responses: "200": description: Sync result content: application/json: schema: $ref: "#/components/schemas/SyncResult" /leaderboard: get: operationId: getLeaderboard tags: [leaderboard] summary: Get ranked leaderboard parameters: - name: period in: query schema: type: string enum: [daily, weekly, monthly, alltime] default: weekly - name: batch in: query schema: type: string - name: limit in: query schema: type: integer default: 20 responses: "200": description: Leaderboard content: application/json: schema: type: array items: $ref: "#/components/schemas/LeaderboardEntry" /stats/dashboard: get: operationId: getDashboardStats tags: [stats] summary: Get dashboard overview stats responses: "200": description: Dashboard stats content: application/json: schema: $ref: "#/components/schemas/DashboardStats" /stats/daily: get: operationId: getDailyStats tags: [stats] summary: Get aggregated daily activity across all students parameters: - name: days in: query schema: type: integer default: 14 responses: "200": description: Daily aggregate stats content: application/json: schema: type: array items: $ref: "#/components/schemas/DailyAggregate" /stats/alerts: get: operationId: getAlerts tags: [stats] summary: Get inactive student alerts and top performer highlights responses: "200": description: Alerts content: application/json: schema: $ref: "#/components/schemas/AlertsResponse" /stats/languages: get: operationId: getLanguageStats tags: [stats] summary: Get top programming languages across all students responses: "200": description: Language breakdown content: application/json: schema: type: array items: $ref: "#/components/schemas/LanguageStat" /batches: get: operationId: listBatches tags: [batches] summary: List all batches with student counts responses: "200": description: Batches content: application/json: schema: type: array items: $ref: "#/components/schemas/BatchSummary" /batches/compare: get: operationId: compareBatches tags: [batches] summary: Compare batch performance parameters: - name: period in: query schema: type: string enum: [daily, weekly, monthly] default: weekly responses: "200": description: Batch comparison content: application/json: schema: type: array items: $ref: "#/components/schemas/BatchComparison" /sync/all: post: operationId: syncAllStudents tags: [sync] summary: Trigger sync for all students responses: "200": description: Sync initiated content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /sync-org: get: operationId: syncOrg tags: [sync] summary: Fetch and sync all members from a GitHub org parameters: - name: org in: query schema: type: string default: Sitare-University responses: "200": description: Org sync result content: application/json: schema: $ref: "#/components/schemas/OrgSyncResult" /run-cron: post: operationId: runCron tags: [sync] summary: Manually trigger the full cron job (org sync + activity fetch) responses: "200": description: Cron started content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /students/{username}/insights: get: operationId: getStudentInsights tags: [insights] summary: Get AI-generated weekly insights for a student parameters: - name: username in: path required: true schema: type: string responses: "200": description: AI insights content: application/json: schema: $ref: "#/components/schemas/StudentInsight" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /students/{username}/insights/generate: post: operationId: generateStudentInsights tags: [insights] summary: Generate (or regenerate) AI insights for a student parameters: - name: username in: path required: true schema: type: string responses: "200": description: Generated insights content: application/json: schema: $ref: "#/components/schemas/StudentInsight" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] ErrorResponse: type: object properties: error: type: string required: [error] SuccessResponse: type: object properties: success: type: boolean message: type: string required: [success] Student: type: object properties: id: type: integer name: type: string username: type: string batch: type: string avatarUrl: type: string nullable: true bio: type: string nullable: true totalCommits: type: integer totalRepos: type: integer totalStars: type: integer score: type: number isActive: type: boolean lastSyncAt: type: string nullable: true createdAt: type: string required: - id - name - username - batch - totalCommits - totalRepos - totalStars - score - isActive - createdAt CreateStudentBody: type: object properties: name: type: string username: type: string batch: type: string required: [name, username, batch] StudentProfile: type: object properties: student: $ref: "#/components/schemas/Student" topRepositories: type: array items: $ref: "#/components/schemas/Repository" languageBreakdown: type: array items: $ref: "#/components/schemas/LanguageStat" recentActivity: type: array items: $ref: "#/components/schemas/DailyActivity" weeklyScore: type: number monthlyScore: type: number streak: type: integer required: - student - topRepositories - languageBreakdown - recentActivity - weeklyScore - monthlyScore - streak Repository: type: object properties: name: type: string description: type: string nullable: true stars: type: integer forks: type: integer language: type: string nullable: true url: type: string updatedAt: type: string nullable: true required: [name, stars, forks, url] DailyActivity: type: object properties: id: type: integer studentId: type: integer date: type: string commits: type: integer reposCreated: type: integer starsReceived: type: integer pullRequests: type: integer issuesOpened: type: integer score: type: number languages: type: array items: type: string required: - id - studentId - date - commits - reposCreated - starsReceived - pullRequests - issuesOpened - score - languages LeaderboardEntry: type: object properties: rank: type: integer student: $ref: "#/components/schemas/Student" score: type: number commits: type: integer repos: type: integer stars: type: integer change: type: integer description: Rank change from previous period required: [rank, student, score, commits, repos, stars, change] DashboardStats: type: object properties: totalStudents: type: integer activeToday: type: integer totalCommitsToday: type: integer totalCommitsWeek: type: integer avgScoreWeek: type: number inactiveCount: type: integer topPerformer: $ref: "#/components/schemas/Student" nullable: true batchCount: type: integer required: - totalStudents - activeToday - totalCommitsToday - totalCommitsWeek - avgScoreWeek - inactiveCount - batchCount DailyAggregate: type: object properties: date: type: string totalCommits: type: integer activeStudents: type: integer totalPRs: type: integer avgScore: type: number required: [date, totalCommits, activeStudents, totalPRs, avgScore] AlertsResponse: type: object properties: inactiveStudents: type: array items: $ref: "#/components/schemas/Student" topPerformers: type: array items: $ref: "#/components/schemas/LeaderboardEntry" required: [inactiveStudents, topPerformers] LanguageStat: type: object properties: language: type: string count: type: integer percentage: type: number required: [language, count, percentage] BatchSummary: type: object properties: batch: type: string studentCount: type: integer avgScore: type: number totalCommits: type: integer required: [batch, studentCount, avgScore, totalCommits] BatchComparison: type: object properties: batch: type: string avgScore: type: number totalCommits: type: integer activeCount: type: integer topStudent: $ref: "#/components/schemas/Student" nullable: true required: [batch, avgScore, totalCommits, activeCount] SyncResult: type: object properties: success: type: boolean username: type: string commitsFound: type: integer message: type: string required: [success, username] StudentInsight: type: object properties: id: type: integer username: type: string weekStart: type: string summary: type: string strengths: type: string weaknesses: type: string suggestions: type: string generatedAt: type: string required: [id, username, weekStart, summary, strengths, weaknesses, suggestions, generatedAt] OrgSyncResult: type: object properties: success: type: boolean added: type: integer skipped: type: integer total: type: integer required: [success, added, skipped, total]