Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a81aced
add use project
arshvinw5 Mar 19, 2026
626a210
correct use project fn
arshvinw5 Mar 19, 2026
9a48bee
Refactor reg fn with mutation
arshvinw5 Mar 20, 2026
a0c7de8
redesgin create account page and refactor code with custom hook for p…
arshvinw5 Mar 21, 2026
254086d
Merge branch '86ewz6naj-Invitation' into 86ewzhmnc-fetch_api
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
9dddce7
refacoting code
arshvinw5 Mar 21, 2026
41650f6
merge refactor code from admin dashboard
arshvinw5 Mar 21, 2026
73a9f45
fix this ui of invitation page
arshvinw5 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
973e32b
fix lint error
arshvinw5 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
514937f
mergin Invitation branch changes
arshvinw5 Mar 22, 2026
affac5c
Apply shared admin components to reports page
muditha20 Mar 22, 2026
b27e9e8
refactor report page
muditha20 Mar 22, 2026
b6b1f82
Merge remote-tracking branch 'origin/86ewz6ncb-Create-the-Report-comp…
Azeez1999 Mar 22, 2026
78c691a
changes
Azeez1999 Mar 22, 2026
858faa3
Refactor user managment section
Azeez1999 Mar 22, 2026
d6aa24b
merge user page changes
arshvinw5 Mar 22, 2026
75bf72e
Code refactor - project
jaleelfathima Mar 22, 2026
d9e77e7
Merge branch '86ewz6ndg-project_dashboard' into 86ewzhmnc-fetch_api
arshvinw5 Mar 22, 2026
74c720b
chnage project ui and badges ui for admin page
arshvinw5 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
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