Documentation

Introduction

Welcome to the URCSTIT Blog App API & User Guide. This platform is designed as a multi-tenant SaaS application for managing class announcements, students, and interactions.

It features a hierarchical role system:

  • Super Admin: Creates Classes (Organizations) and Class Representatives.
  • Class Representative: Manages students and posts announcements for their specific class.
  • Student: Registers with a unique Class Code and views class-specific content.

Authentication

POST
/api/auth/register

Register a new student account.

// Request Body
{
  "email": "student@example.com",
  "password": "securepassword",
  "name": "Jane Doe",
  "classCode": "CS101" // Required to join a specific class
}
POST
/api/auth/login

Authenticate and receive a JWT token.

// Response
{
  "token": "eyJhbGcV...",
  "user": {
    "id": "123",
    "email": "...",
    "role": "student" | "class_rep" | "super_admin",
    "organizationId": "..."
  }
}
POST
/api/auth/forgot-password

Initiate password reset via email.

// Request Body
{
  "email": "user@example.com"
}
POST
/api/auth/reset-password

Complete password reset with token.

PUT
/api/auth/profile

Update current user's profile (Authenticated).

// Request Body
{
  "name": "New Name",
  "password": "newSecurePassword" // optional
}

Posts & Announcements

GET
/api/posts

Fetch announcements. Publicly accessible.

Query Parameters:

  • classCode (optional): Filter posts by strict class code (e.g., ?classCode=CS101).
  • page (optional): Page number (default: 0 = all).
  • limit (optional): Items per page (default: 0 = all).
POST
/api/posts

Create a new announcement. (Class Rep & Super Admin only)

Automatically tags the post with the creator's organizationId and classCode.


Admin & Classes

POST
/api/admin/classes

Create a new Class (Organization) and its first Class Representative.

Super Admin Only
// Request Body
{
  "className": "Computer Science 2024",
  "classCode": "CS2024",
  "repName": "John Rep",
  "repEmail": "rep@cs2024.com",
  "repPassword": "repPassword123"
}

User Guide

For Students
  1. Register: Go to /register. Enter your details and the Class Code provided by your rep.
  2. Wait for Approval: Your account will be pending until the Class Rep approves it.
  3. Browse: Once approved, login to see announcements. You can also search for your class code on the home page without logging in.
  4. Chat: Use the Chat feature to message other students in your class.
For Class Representatives
  1. Manage Students: Go to the Dashboard to see pending student requests. Approve or Reject them.
  2. Post Announcements: Create posts for your class. You can choose to notify specific students via email.
For Super Admins
  1. Create Classes: Use the "Create Class" tab in the Admin Dashboard to onboard new classes.
  2. Manage the Platform: You have oversight of all users and posts.