Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2252ada
Developed side panel and report page
muditha20 Mar 19, 2026
4b0a4c7
Merge branch 'dev-stage' into 86ewz6ncb-Create-the-Report-component
muditha20 Mar 19, 2026
b0d94b9
Finalize the Invitation Component
ruchiralak Mar 19, 2026
a81aced
add use project
arshvinw5 Mar 19, 2026
626a210
correct use project fn
arshvinw5 Mar 19, 2026
b842a9e
Implemented user managment section
Azeez1999 Mar 19, 2026
d087328
Update-invitationAPI-documentations
ruchiralak Mar 19, 2026
4b7d7d1
New change
ruchiralak Mar 19, 2026
1a1f2f0
new changes
ruchiralak Mar 19, 2026
12c767b
remove .env from tracking
ruchiralak Mar 19, 2026
9a48bee
Refactor reg fn with mutation
arshvinw5 Mar 20, 2026
73de91c
Finalize-SuperAdmin-Component
ShasmaAfs Mar 20, 2026
6124426
add project dashbaord
jaleelfathima Mar 20, 2026
0d9cf5f
Fix some bugs
ruchiralak Mar 20, 2026
2e12c3c
Update the invitation layout
ruchiralak Mar 21, 2026
d3c5089
update aside bar and cards
muditha20 Mar 21, 2026
48a80ce
fix: resolved merge conflicts for report component branch
ruchiralak Mar 21, 2026
a9be787
docs: update API invitations documentation
ruchiralak Mar 21, 2026
030b14d
Finalize the Super admin Component
ruchiralak Mar 21, 2026
a0c7de8
redesgin create account page and refactor code with custom hook for p…
arshvinw5 Mar 21, 2026
a782760
Refactor the Invitation code base
ruchiralak Mar 21, 2026
cfda147
Fix lint error
ruchiralak Mar 21, 2026
52fcd3c
Admin-reports code refactor
muditha20 Mar 21, 2026
8c31a38
Merge origin/86ewzhmnc-fetch_api into 86ewz6ncb-Create-the-Report-com…
muditha20 Mar 22, 2026
b74a746
Resolve conflicts
ruchiralak Mar 22, 2026
d350348
Shared components
ruchiralak Mar 22, 2026
13ea337
changed table view of report page
muditha20 Mar 22, 2026
fe0bbb6
Merge origin/86ewz6naj-Invitation: resolve useGetInvitation conflict
muditha20 Mar 22, 2026
affac5c
Apply shared admin components to reports page
muditha20 Mar 22, 2026
b27e9e8
refactor report page
muditha20 Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
755 changes: 755 additions & 0 deletions docs/api/API_INVITATIONS.md

Large diffs are not rendered by default.

415 changes: 415 additions & 0 deletions docs/api/API_PROJECTS.md

Large diffs are not rendered by default.

148 changes: 148 additions & 0 deletions docs/api/API_Registration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# API Guide

Welcome to the Digital Logbook API documentation. This guide provides an overview of available endpoints and how to use them.

## Table of Contents

- [Authentication](#authentication)
- [Endpoints](#endpoints)
- [Projects](#projects)
- [Invitations](#invitations)
- [Error Handling](#error-handling)
- [Best Practices](#best-practices)

## Authentication

All API endpoints require authentication via JWT tokens. Include the token in the `Authorization` header:

```
Authorization: Bearer <your_jwt_token>
```

## Endpoints

### Projects

For detailed project endpoint documentation, see [API_PROJECTS.md](./API_PROJECTS.md)

**Available Operations:**

- Get all projects
- Get project by ID
- Create new project
- Update project
- Delete project
- Manage project allocations

### Invitations

For detailed invitation endpoint documentation, see [API_INVITATIONS.md](./API_INVITATIONS.md)

**Available Operations:**

- Send invitations
- Validate invitation tokens
- Accept invitations
- Resend invitations

## Error Handling

All endpoints return standard HTTP status codes:

| Status | Meaning |
| ------ | --------------------- |
| 200 | Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 404 | Not Found |
| 500 | Internal Server Error |

### Error Response Format

```json
{
"error": "Error description"
}
```

## Best Practices

### 1. Request Validation

- Always validate input data before sending requests
- Check that required fields are present
- Ensure data types match expected values

### 2. Error Handling

- Implement proper try-catch blocks
- Handle specific error messages from the API
- Log errors for debugging

### 3. Performance

- Use pagination for large datasets
- Cache responses when appropriate
- Implement request debouncing on the frontend

### 4. Security

- Never expose JWT tokens in logs
- Always use HTTPS in production
- Validate tokens on the backend
- Implement rate limiting on sensitive endpoints

### 5. Testing

- Test all endpoints with valid and invalid data
- Verify error handling
- Test edge cases and boundary conditions

## Frontend Integration

When using these APIs in the frontend, consider using:

- **TanStack Query (React Query)** for caching and state management
- **Custom Hooks** for reusable API logic
- **Error Boundaries** for graceful error handling
- **Toast Notifications** for user feedback

### Example Hook Pattern

```typescript
import { useMutation } from "@tanstack/react-query";

export const useYourMutation = () => {
return useMutation({
mutationFn: async (payload) => {
const response = await fetch("/api/endpoint", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});

if (!response.ok) {
throw new Error("Request failed");
}

return response.json();
},
onSuccess: (data) => {
// Handle success
},
onError: (error) => {
// Handle error
},
});
};
```

## Additional Resources

- [Database Schema](../schema/README.md)
- [Project Endpoints](./API_PROJECTS.md)
- [Invitation Endpoints](./API_INVITATIONS.md)

---

For questions or issues, please refer to the main [README.md](../../README.md)
Loading
Loading