|
| 1 | +# Build Instructions - Final Steps |
| 2 | + |
| 3 | +## Current Situation |
| 4 | + |
| 5 | +✅ **Swagger Integration**: 100% Complete |
| 6 | +✅ **Rust Installed**: v1.94.0 |
| 7 | +✅ **Code Ready**: All files properly configured |
| 8 | +⚠️ **Build Tools**: Need to be recognized by terminal |
| 9 | + |
| 10 | +## Issue |
| 11 | + |
| 12 | +The Visual Studio Build Tools are installed but the terminal needs to be restarted to recognize them, OR you need to use the Developer Command Prompt. |
| 13 | + |
| 14 | +## Solution Options |
| 15 | + |
| 16 | +### Option 1: Restart Terminal (Recommended) |
| 17 | + |
| 18 | +1. **Close this PowerShell/Terminal completely** |
| 19 | +2. **Open a NEW PowerShell or Command Prompt** |
| 20 | +3. **Navigate back to project:** |
| 21 | + ```powershell |
| 22 | + cd C:\Users\hp\Desktop\Drips\School_API |
| 23 | + ``` |
| 24 | +4. **Try building:** |
| 25 | + ```powershell |
| 26 | + cargo check |
| 27 | + ``` |
| 28 | + |
| 29 | +### Option 2: Use Developer Command Prompt |
| 30 | + |
| 31 | +1. **Press Windows Key** |
| 32 | +2. **Search for**: "Developer Command Prompt for VS 2022" |
| 33 | +3. **Open it** |
| 34 | +4. **Navigate to project:** |
| 35 | + ```cmd |
| 36 | + cd C:\Users\hp\Desktop\Drips\School_API |
| 37 | + ``` |
| 38 | +5. **Build:** |
| 39 | + ```cmd |
| 40 | + cargo check |
| 41 | + ``` |
| 42 | + |
| 43 | +### Option 3: Use Developer PowerShell |
| 44 | + |
| 45 | +1. **Press Windows Key** |
| 46 | +2. **Search for**: "Developer PowerShell for VS 2022" |
| 47 | +3. **Open it** |
| 48 | +4. **Navigate to project:** |
| 49 | + ```powershell |
| 50 | + cd C:\Users\hp\Desktop\Drips\School_API |
| 51 | + ``` |
| 52 | +5. **Build:** |
| 53 | + ```powershell |
| 54 | + cargo check |
| 55 | + ``` |
| 56 | + |
| 57 | +### Option 4: Manual PATH Setup (Advanced) |
| 58 | + |
| 59 | +Add to your PATH environment variable: |
| 60 | +``` |
| 61 | +C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\<version>\bin\Hostx64\x64 |
| 62 | +C:\Program Files (x86)\Windows Kits\10\bin\<version>\x64 |
| 63 | +``` |
| 64 | + |
| 65 | +Then restart terminal. |
| 66 | + |
| 67 | +## After Successful Build |
| 68 | + |
| 69 | +Once `cargo check` succeeds, you'll see: |
| 70 | + |
| 71 | +``` |
| 72 | + Compiling proc-macro2 v1.0.106 |
| 73 | + Compiling unicode-ident v1.0.14 |
| 74 | + Compiling syn v2.0.95 |
| 75 | + ... |
| 76 | + Checking school_api v0.1.0 |
| 77 | + Finished `dev` profile [unoptimized + debuginfo] target(s) in 2m 15s |
| 78 | +``` |
| 79 | + |
| 80 | +Then run: |
| 81 | + |
| 82 | +```powershell |
| 83 | +# Build the project |
| 84 | +cargo build |
| 85 | +
|
| 86 | +# Run the server |
| 87 | +cargo run |
| 88 | +``` |
| 89 | + |
| 90 | +## Access Swagger Documentation |
| 91 | + |
| 92 | +Once the server is running, open your browser: |
| 93 | + |
| 94 | +``` |
| 95 | +http://localhost:3000/docs |
| 96 | +``` |
| 97 | + |
| 98 | +You'll see: |
| 99 | +- ✅ All 38 endpoints documented |
| 100 | +- ✅ All 16 schemas with examples |
| 101 | +- ✅ Interactive "Try it out" buttons |
| 102 | +- ✅ JWT authentication support |
| 103 | +- ✅ Complete API documentation |
| 104 | + |
| 105 | +## Test the API |
| 106 | + |
| 107 | +### 1. Test Health Check |
| 108 | +``` |
| 109 | +GET http://localhost:3000/health |
| 110 | +``` |
| 111 | + |
| 112 | +### 2. Register Admin |
| 113 | +``` |
| 114 | +POST http://localhost:3000/auth/admin/register |
| 115 | +{ |
| 116 | + "email": "admin@school.com", |
| 117 | + "password": "SecurePass123!", |
| 118 | + "first_name": "John", |
| 119 | + "last_name": "Admin", |
| 120 | + "role": "admin" |
| 121 | +} |
| 122 | +``` |
| 123 | + |
| 124 | +### 3. Login Admin (Get OTP) |
| 125 | +``` |
| 126 | +POST http://localhost:3000/auth/admin/login |
| 127 | +{ |
| 128 | + "email": "admin@school.com", |
| 129 | + "password": "SecurePass123!" |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +### 4. Verify OTP |
| 134 | +``` |
| 135 | +POST http://localhost:3000/auth/verify-otp |
| 136 | +{ |
| 137 | + "email": "admin@school.com", |
| 138 | + "otp": "123456" |
| 139 | +} |
| 140 | +``` |
| 141 | + |
| 142 | +### 5. Use Token for Protected Endpoints |
| 143 | +- Copy the `access_token` from step 4 |
| 144 | +- Click "Authorize" in Swagger UI |
| 145 | +- Enter: `Bearer <your_token>` |
| 146 | +- Test any protected endpoint |
| 147 | + |
| 148 | +## Troubleshooting |
| 149 | + |
| 150 | +### If cargo check still fails: |
| 151 | + |
| 152 | +1. **Verify VS Build Tools installation:** |
| 153 | + - Open "Add or Remove Programs" |
| 154 | + - Search for "Visual Studio Build Tools" |
| 155 | + - Click "Modify" |
| 156 | + - Ensure "Desktop development with C++" is checked |
| 157 | + - Ensure these components are installed: |
| 158 | + - MSVC v143 - VS 2022 C++ x64/x86 build tools |
| 159 | + - Windows 10/11 SDK |
| 160 | + |
| 161 | +2. **Restart your computer** (sometimes required for PATH updates) |
| 162 | + |
| 163 | +3. **Try Developer Command Prompt** (Option 2 above) |
| 164 | + |
| 165 | +## Summary |
| 166 | + |
| 167 | +Your Swagger integration is complete. The only step remaining is getting the build tools recognized by your terminal. The easiest solution is: |
| 168 | + |
| 169 | +1. **Close current terminal** |
| 170 | +2. **Open new terminal** |
| 171 | +3. **Run `cargo check`** |
| 172 | +4. **Run `cargo run`** |
| 173 | +5. **Visit `http://localhost:3000/docs`** |
| 174 | + |
| 175 | +Everything is ready to go! 🚀 |
0 commit comments