openapi: 3.1.0 info: title: Api version: 0.1.0 description: San George Scouts API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: Auth description: Browser authentication endpoints - name: Users description: User management - name: Badges description: Badge management - name: Attendance description: Attendance tracking - name: Announcements description: Group announcements - name: Posts description: Community posts and files - name: Storage description: File upload and serving paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/user: get: tags: [Auth] operationId: getCurrentAuthUser summary: Get the currently authenticated user parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' responses: '200': description: Auth status resolved successfully. content: application/json: schema: $ref: '#/components/schemas/AuthUserEnvelope' /login: get: tags: [Auth] operationId: beginBrowserLogin summary: Start the browser OIDC login flow parameters: - name: returnTo in: query required: false schema: type: string responses: '302': description: Redirect to the OIDC authorization endpoint. /callback: get: tags: [Auth] operationId: handleBrowserLoginCallback summary: Complete the browser OIDC login flow parameters: - name: code in: query required: false schema: type: string - name: state in: query required: false schema: type: string - name: iss in: query required: false schema: type: string format: uri responses: '302': description: Redirect on success or failure. /logout: get: tags: [Auth] operationId: logoutBrowserSession summary: Clear the session and begin OIDC logout parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' responses: '302': description: Redirect to the OIDC provider logout URL. /users: get: tags: [Users] operationId: listUsers summary: List all registered users (leader only) responses: '200': description: List of users content: application/json: schema: type: array items: $ref: '#/components/schemas/ScoutUser' /users/me: get: tags: [Users] operationId: getMyProfile summary: Get current user profile with role responses: '200': description: Current user profile content: application/json: schema: $ref: '#/components/schemas/ScoutUser' /users/{userId}/role: patch: tags: [Users] operationId: updateUserRole summary: Update a user's role (leader only) parameters: - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UserRoleUpdate' responses: '200': description: Updated user content: application/json: schema: $ref: '#/components/schemas/ScoutUser' /badges/{userId}: get: tags: [Badges] operationId: getUserBadges summary: Get a user's badges (public) parameters: - name: userId in: path required: true schema: type: string responses: '200': description: User badges content: application/json: schema: $ref: '#/components/schemas/UserBadges' /badges/{userId}/main-badge: put: tags: [Badges] operationId: setMainBadge summary: Set a user's main badge (admin only) parameters: - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BadgeAssignment' responses: '200': description: Badge updated content: application/json: schema: $ref: '#/components/schemas/UserBadges' delete: tags: [Badges] operationId: removeMainBadge summary: Remove a user's main badge (admin only) parameters: - name: userId in: path required: true schema: type: string responses: '200': description: Badge removed content: application/json: schema: $ref: '#/components/schemas/UserBadges' /badges/{userId}/proficiency: post: tags: [Badges] operationId: addProficiencyBadge summary: Add a proficiency badge (admin only) parameters: - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BadgeAssignment' responses: '200': description: Badge added content: application/json: schema: $ref: '#/components/schemas/ProficiencyBadgesResponse' /badges/{userId}/proficiency/{badgeName}: delete: tags: [Badges] operationId: removeProficiencyBadge summary: Remove a proficiency badge (admin only) parameters: - name: userId in: path required: true schema: type: string - name: badgeName in: path required: true schema: type: string responses: '200': description: Badge removed content: application/json: schema: $ref: '#/components/schemas/ProficiencyBadgesResponse' /badges/{userId}/hobby: post: tags: [Badges] operationId: addHobbyBadge summary: Add a hobby badge (admin only) parameters: - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BadgeAssignment' responses: '200': description: Badge added content: application/json: schema: $ref: '#/components/schemas/HobbyBadgesResponse' /badges/{userId}/hobby/{badgeName}: delete: tags: [Badges] operationId: removeHobbyBadge summary: Remove a hobby badge (admin only) parameters: - name: userId in: path required: true schema: type: string - name: badgeName in: path required: true schema: type: string responses: '200': description: Badge removed content: application/json: schema: $ref: '#/components/schemas/HobbyBadgesResponse' /users/stats: get: tags: [Users] operationId: getUserStats summary: Get dashboard stats (total scouts, total leaders) responses: '200': description: User statistics content: application/json: schema: $ref: '#/components/schemas/UserStats' /attendance/sessions: get: tags: [Attendance] operationId: listAttendanceSessions summary: List all attendance sessions responses: '200': description: List of sessions content: application/json: schema: type: array items: $ref: '#/components/schemas/AttendanceSession' post: tags: [Attendance] operationId: createAttendanceSession summary: Create a new attendance session (leader only) requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AttendanceSessionInput' responses: '201': description: Session created content: application/json: schema: $ref: '#/components/schemas/AttendanceSession' /attendance/sessions/{sessionId}: get: tags: [Attendance] operationId: getAttendanceSession summary: Get a session with all scout attendance records parameters: - name: sessionId in: path required: true schema: type: string responses: '200': description: Session detail with records content: application/json: schema: $ref: '#/components/schemas/AttendanceSessionDetail' /attendance/sessions/{sessionId}/records: post: tags: [Attendance] operationId: submitAttendanceRecords summary: Submit attendance records for a session (leader only) parameters: - name: sessionId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AttendanceRecordsBatch' responses: '200': description: Records saved content: application/json: schema: $ref: '#/components/schemas/AttendanceSessionDetail' /attendance/my-summary: get: tags: [Attendance] operationId: getMyAttendanceSummary summary: Get the current scout's attendance summary responses: '200': description: My attendance summary content: application/json: schema: $ref: '#/components/schemas/AttendanceSummary' /announcements: get: tags: [Announcements] operationId: listAnnouncements summary: List all announcements (newest first) responses: '200': description: List of announcements content: application/json: schema: type: array items: $ref: '#/components/schemas/Announcement' post: tags: [Announcements] operationId: createAnnouncement summary: Create an announcement (leader only) requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AnnouncementInput' responses: '201': description: Announcement created content: application/json: schema: $ref: '#/components/schemas/Announcement' /announcements/{announcementId}: delete: tags: [Announcements] operationId: deleteAnnouncement summary: Delete an announcement (leader only) parameters: - name: announcementId in: path required: true schema: type: string responses: '200': description: Deleted content: application/json: schema: $ref: '#/components/schemas/DeleteSuccess' /announcements/{announcementId}/replies: get: tags: [Announcements] operationId: listAnnouncementReplies summary: List replies for an announcement (any authenticated user) parameters: - name: announcementId in: path required: true schema: type: string responses: '200': description: List of replies (oldest first) content: application/json: schema: type: array items: $ref: '#/components/schemas/AnnouncementReply' post: tags: [Announcements] operationId: createAnnouncementReply summary: Reply to an announcement (any authenticated user) parameters: - name: announcementId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/AnnouncementReplyInput' responses: '201': description: Reply created content: application/json: schema: $ref: '#/components/schemas/AnnouncementReply' /announcements/{announcementId}/replies/{replyId}: delete: tags: [Announcements] operationId: deleteAnnouncementReply summary: Delete a reply (author can delete own; leader can delete any) parameters: - name: announcementId in: path required: true schema: type: string - name: replyId in: path required: true schema: type: string responses: '200': description: Deleted content: application/json: schema: $ref: '#/components/schemas/DeleteSuccess' /posts: get: tags: [Posts] operationId: listPosts summary: List all posts (newest first) responses: '200': description: List of posts content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' post: tags: [Posts] operationId: createPost summary: Create a post (any authenticated user) requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostInput' responses: '201': description: Post created content: application/json: schema: $ref: '#/components/schemas/Post' /posts/{postId}: delete: tags: [Posts] operationId: deletePost summary: Delete a post (leader can delete any; scout can delete own) parameters: - name: postId in: path required: true schema: type: integer responses: '200': description: Deleted content: application/json: schema: $ref: '#/components/schemas/DeleteSuccess' /storage/uploads/request-url: post: tags: [Storage] operationId: requestUploadUrl summary: Request a presigned upload URL requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UploadUrlRequest' responses: '200': description: Presigned upload URL content: application/json: schema: $ref: '#/components/schemas/UploadUrlResponse' /storage/objects/{objectPath}: get: tags: [Storage] operationId: getObject summary: Serve an uploaded object parameters: - name: objectPath in: path required: true schema: type: string responses: '200': description: Object content components: parameters: AuthorizationSessionHeader: name: Authorization in: header required: false schema: type: string SessionCookie: name: sid in: cookie required: false schema: type: string schemas: HealthStatus: type: object required: [status] properties: status: type: string AuthUser: type: object required: [id, email, firstName, lastName, profileImageUrl] properties: id: type: string email: type: ["string", "null"] format: email firstName: type: ["string", "null"] lastName: type: ["string", "null"] profileImageUrl: type: ["string", "null"] AuthUserEnvelope: type: object required: [user] properties: user: oneOf: - $ref: '#/components/schemas/AuthUser' - type: 'null' ScoutUser: type: object required: [id, replitId, firstName, lastName, email, role, createdAt] properties: id: type: string replitId: type: string firstName: type: ["string", "null"] lastName: type: ["string", "null"] email: type: ["string", "null"] profileImageUrl: type: ["string", "null"] patrol: type: ["string", "null"] role: type: string enum: [scout, cp, cp_of_cps, leader, developer] createdAt: type: string format: date-time UserRoleUpdate: type: object required: [role] properties: role: type: string enum: [scout, cp, cp_of_cps, leader, developer] UserStats: type: object required: [totalScouts, totalCp, totalCpOfCps, totalLeaders, totalDevelopers, totalMembers] properties: totalScouts: type: integer totalCp: type: integer totalCpOfCps: type: integer totalLeaders: type: integer totalDevelopers: type: integer totalMembers: type: integer AttendanceSession: type: object required: [id, title, sessionDate, createdAt, attendedCount, totalCount] properties: id: type: string title: type: string sessionDate: type: string format: date-time notes: type: ["string", "null"] createdAt: type: string format: date-time attendedCount: type: integer totalCount: type: integer excusedCount: type: integer withGearCount: type: integer AttendanceSessionInput: type: object required: [title, sessionDate] properties: title: type: string minLength: 1 sessionDate: type: string format: date-time notes: type: string AttendanceRecord: type: object required: [userId, scoutName, status] properties: userId: type: string scoutName: type: ["string", "null"] profileImageUrl: type: ["string", "null"] status: type: string enum: [present, absent] excuse: type: boolean hasGear: type: boolean AttendanceSessionDetail: type: object required: [id, title, sessionDate, createdAt, records] properties: id: type: string title: type: string sessionDate: type: string format: date-time notes: type: ["string", "null"] createdAt: type: string format: date-time records: type: array items: $ref: '#/components/schemas/AttendanceRecord' AttendanceRecordItem: type: object required: [userId, status] properties: userId: type: string status: type: string enum: [present, absent] excuse: type: boolean hasGear: type: boolean AttendanceRecordsBatch: type: object required: [records] properties: records: type: array items: $ref: '#/components/schemas/AttendanceRecordItem' AttendanceSummary: type: object required: [totalSessions, attended, absent, rate] properties: totalSessions: type: integer attended: type: integer absent: type: integer absentExcused: type: integer absentUnexcused: type: integer withoutGear: type: integer rate: type: number Announcement: type: object required: [id, title, content, createdAt, authorName] properties: id: type: string title: type: string content: type: string createdAt: type: string format: date-time authorName: type: ["string", "null"] authorImageUrl: type: ["string", "null"] replies: type: array items: $ref: '#/components/schemas/AnnouncementReply' AnnouncementReply: type: object required: [id, announcementId, authorUserId, content, createdAt, authorName] properties: id: type: string announcementId: type: string authorUserId: type: string content: type: string createdAt: type: string format: date-time authorName: type: ["string", "null"] authorImageUrl: type: ["string", "null"] AnnouncementReplyInput: type: object required: [content] properties: content: type: string minLength: 1 AnnouncementInput: type: object required: [title, content] properties: title: type: string minLength: 1 content: type: string minLength: 1 Post: type: object required: [id, content, createdAt, authorId, authorName] properties: id: type: integer content: type: string fileUrl: type: ["string", "null"] fileName: type: ["string", "null"] fileType: type: ["string", "null"] createdAt: type: string format: date-time authorId: type: integer authorName: type: ["string", "null"] authorRole: type: string authorImageUrl: type: ["string", "null"] PostInput: type: object required: [content] properties: content: type: string minLength: 1 fileUrl: type: string fileName: type: string fileType: type: string DeleteSuccess: type: object required: [success] properties: success: type: boolean UploadUrlRequest: type: object required: [name, size, contentType] properties: name: type: string size: type: integer contentType: type: string UploadUrlResponse: type: object required: [uploadURL, objectPath] properties: uploadURL: type: string objectPath: type: string UserBadges: type: object properties: mainBadge: type: ["string", "null"] proficiencyBadges: type: array items: type: string hobbyBadges: type: array items: type: string BadgeAssignment: type: object required: [badge] properties: badge: type: string ProficiencyBadgesResponse: type: object properties: proficiencyBadges: type: array items: type: string HobbyBadgesResponse: type: object properties: hobbyBadges: type: array items: type: string