Skip to content

Commit

Permalink
Updates docs after update v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KSJaay committed Jun 4, 2024
1 parent 16c139f commit 9ae0b31
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/components/settings/manage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ManageTeam = () => {

const sortedMembers = team
?.sort((a, b) => a?.permission - b?.permission)
.sort((a, b) => a?.isVerified - b?.isVerified);
.sort((a, b) => b?.isVerified - a?.isVerified);

useEffect(() => {
const fetchTeam = async () => {
Expand Down
178 changes: 167 additions & 11 deletions docs/api/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Update the username for the current logged in user.
| ----------- | ---------------------------------------------------------- |
| 200 | Success, username has been updates |
| 400 | Bad Request, displayName not provided or is invalid format |
| 401 | Unauthorized (Missing `access_token` cookie or API Token) |
| 401 | Unauthorized (Missing `access_token` cookie) |
| 403 | User is unverified |

</template>
Expand All @@ -256,7 +256,6 @@ Update the username for the current logged in user.
```[cURL]
curl -X POST
-H "Content-Type:application/json"
-H "Authorization:API Token"
--data '{"displayName":"Not KSJaay"}'
"https://lunalytics.xyz/api/user/update/username"
```
Expand All @@ -265,7 +264,6 @@ curl -X POST
axios('/api/user/update/username', {
method: 'POST',
headers: {
Authorization: 'API Token',
'Content-Type': 'application/json',
},
data: {
Expand All @@ -281,6 +279,65 @@ axios('/api/user/update/username', {

<DividePage>

## Update user password

<template #left>

### <Badge type="post" text="POST" /> /api/user/update/password

Update the password for the current logged in user.

### Payload

```json
{
"currentPassword": "ReallyOldPassword123",
"newPassword": "ReallySecurePassword123"
}
```

### HTTP Response Codes

| Status Code | Description |
| ----------- | ----------------------------------------------------------------------------- |
| 200 | Success, username has been updates |
| 400 | Bad Request, currentPassword or newPassword not provided or is invalid format |
| 401 | Unauthorized (Missing `access_token` cookie or user password is invalid) |
| 403 | User is unverified |

</template>

<template #right>

::: code-group

```[cURL]
curl -X POST
-H "Content-Type:application/json"
--data '{"currentPassword": "ReallyOldPassword123", "newPassword": "ReallySecurePassword123"}'
"https://lunalytics.xyz/api/user/update/password"
```

```js [axios]
axios('/api/user/update/password', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: {
currentPassword: 'ReallyOldPassword123',
newPassword: 'ReallySecurePassword123',
},
});
```

:::

</template>
</DividePage>

<DividePage>

## Update user avatar

<template #left>
Expand All @@ -299,12 +356,12 @@ Update the avatar for the current logged in user.

### HTTP Response Codes

| Status Code | Description |
| ----------- | --------------------------------------------------------- |
| 200 | Success, avatar has been updates |
| 400 | Bad Request, avatar not provided or is invalid format |
| 401 | Unauthorized (Missing `access_token` cookie or API Token) |
| 403 | User is unverified |
| Status Code | Description |
| ----------- | ----------------------------------------------------- |
| 200 | Success, avatar has been updates |
| 400 | Bad Request, avatar not provided or is invalid format |
| 401 | Unauthorized (Missing `access_token` cookie) |
| 403 | User is unverified |

</template>

Expand All @@ -315,7 +372,6 @@ Update the avatar for the current logged in user.
```[cURL]
curl -X POST
-H "Content-Type:application/json"
-H "Authorization:API Token"
--data '{"avatar":"https://lunalytics.xyz/icons/Gerbil.png"}'
"https://lunalytics.xyz/api/user/update/avatar"
```
Expand All @@ -324,7 +380,6 @@ curl -X POST
axios('/api/user/update/avatar', {
method: 'POST',
headers: {
Authorization: 'API Token',
'Content-Type': 'application/json',
},
data: {
Expand Down Expand Up @@ -621,3 +676,104 @@ axios('/api/user/permission/update', {

</template>
</DividePage>

<DividePage>

## Transfer Ownership

<template #left>

### <Badge type="post" text="POST" /> /api/user/transfer/ownership

Transfer the ownership of to another user. Only the owner can access this endpoint, and the owners role will then be updated to a guest. This action is irreversible.

### Payload

```json
{
"email": "KSJaay@lunalytics.xyz"
}
```

### HTTP Response Codes

| Status Code | Description |
| ----------- | -------------------------------------------------------------------------- |
| 200 | Success, ownership has been transferred |
| 400 | Bad Request, email not provided, user doesn't exist, or invalid permission |
| 401 | Unauthorized (Missing `access_token` cookie, or user isn't an admin/owner) |
| 403 | User is unverified |

</template>

<template #right>

::: code-group

```[cURL]
curl -X POST
-H "Content-Type:application/json"
--data '{"email":"KSJaay@lunalytics.xyz"}'
"https://lunalytics.xyz/api/user/transfer/ownership"
```

```js [axios]
axios('/api/user/transfer/ownership', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: {
email: 'KSJaay@lunalytics.xyz',
},
});
```

:::

</template>
</DividePage>

<DividePage>

## Delete Account

<template #left>

### <Badge type="post" text="POST" /> /api/user/delete/account

Delete the users account, user won't be able to do this unless they have transferred their ownership.

### HTTP Response Codes

| Status Code | Description |
| ----------- | ------------------------------------------------------------------- |
| 200 | Success, delete your account |
| 401 | Unauthorized (Missing `access_token` cookie, or user doesn't exist) |
| 403 | User has ownership |

</template>

<template #right>

::: code-group

```[cURL]
curl -X POST
-H "Content-Type:application/json"
"https://lunalytics.xyz/api/user/delete/account"
```

```js [axios]
axios('/api/user/delete/account', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
```

:::

</template>
</DividePage>
36 changes: 36 additions & 0 deletions docs/internals/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Previous updates

## v0.5.0

### Overhaul for settings page

### Summary

This has been a pretty big update, and took a lot longer than I thought it was going to. I decided to overhaul the whole settings page as it was pretty bad UX, and the mobile experience was pretty much unusable. The new UI now renders a different journey for PC and mobile. Both journeys now being a lot more user friendly and easier to use (at least in my opinion). While working on the settings page, I also decided to add a few new customisation features and fixed a few bugs I found.

### New Features

- Settings page overhaul
- Account management and personalisation moved to their own pages
- Users can now upload URls for avatars (Still able to select from preset avatars)
- Ability to change user password
- Ability to transfer ownership
- Ability to delete your account (Won't delete monitors you've setup)
- Added three new endpoints:
- `/api/user/update/password`
- `/api/user/transfer/ownership`
- `/api/user/delete/account`
- Adds tooltip component
- `useGoBack` hook to go back a page

### Updates

- Added search bar to status code input
- Fixes issues with certs not being fetched on initial load
- Fixes issues with fetching certs crashes server
- Adds buttons with outlines only
- Adds icons to text input (left and right side)
- Reworks timezones files
- Adds new icons
- Setup test servers
- Fixes issues CSS with UX components
- Fixes issues with random issues on server side

## v0.4.7

### Fixes issues with sonner css not loading
Expand Down

0 comments on commit 9ae0b31

Please sign in to comment.