Finished documentation

This commit is contained in:
2024-11-22 14:18:40 +01:00
parent 0c2c02136d
commit fee99c60b6
5 changed files with 98 additions and 32 deletions

View File

@@ -1,13 +0,0 @@
# HopFrame Documentation
- [x] In code documentation
- [x] Installation
- [x] Database usage
- [x] Authorization usage
- [x] LogicResult usage
- [x] Repositories usage
- [x] AuthService usage
- [x] AuthMiddleware usage
- [x] AdminPages usage
- [x] Endpoints usage
- [x] Blazor pages usage

View File

@@ -14,8 +14,8 @@ Base endpoint: `/api/v1/authentication`\
| Method | Endpoint | Payload | Returns | | Method | Endpoint | Payload | Returns |
|--------|---------------|--------------------------------------------------------------|-----------------------| |--------|---------------|--------------------------------------------------------------|-----------------------|
| PUT | /login | [UserLogin](./models.md#UserLogin) | access token (string) | | PUT | /login | [UserLogin](../models.md#UserLogin) | access token (string) |
| POST | /register | [UserRegister](./models#UserRegister) | access token (string) | | POST | /register | [UserRegister](../models.md#UserRegister) | access token (string) |
| GET | /authenticate | | access token (string) | | GET | /authenticate | | access token (string) |
| DELETE | /logout | | | | DELETE | /logout | | |
| DELETE | /delete | [UserPasswordValidation](./models.md#UserPasswordValidation) | | | DELETE | /delete | [UserPasswordValidation](./models.md#UserPasswordValidation) | |

View File

@@ -8,23 +8,6 @@ public struct SingleValueResult<TValue>(TValue value) {
} }
``` ```
## UserLogin
```csharp
public class UserLogin {
public string Email { get; set; }
public string Password { get; set; }
}
```
## UserRegister
```csharp
public class UserRegister {
public string Username { get; set; }
public string Email { get; set; }
public string Password { get; set; }
}
```
## UserPasswordValidation ## UserPasswordValidation
```csharp ```csharp
public sealed class UserPasswordValidation { public sealed class UserPasswordValidation {

71
docs/models.md Normal file
View File

@@ -0,0 +1,71 @@
# HopFrame base models
All models listed below are part of the core HopFrame components and accessible in all installation variations
> **Note:** All properties of the models that are `virtual` are relational properties and don't directly correspond to columns in the database.
## User
```csharp
public class User : IPermissionOwner {
public Guid Id { get; init; }
public string Username { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public DateTime CreatedAt { get; set; }
public virtual List<Permission> Permissions { get; set; }
public virtual List<Token> Tokens { get; set; }
}
```
## PermissionGroup
```csharp
public class PermissionGroup : IPermissionOwner {
public string Name { get; init; }
public bool IsDefaultGroup { get; set; }
public string Description { get; set; }
public DateTime CreatedAt { get; set; }
public virtual List<Permission> Permissions { get; set; }
}
```
## Permission
```csharp
public class Permission {
public long Id { get; init; }
public string PermissionName { get; set; }
public DateTime GrantedAt { get; set; }
public virtual User User { get; set; }
public virtual PermissionGroup Group { get; set; }
}
```
## Token
```csharp
public class Token {
public int Type { get; set; }
public Guid Content { get; set; }
public DateTime CreatedAt { get; set; }
public virtual User Owner { get; set; }
}
```
## UserLogin
```csharp
public class UserLogin {
public string Email { get; set; }
public string Password { get; set; }
}
```
## UserRegister
```csharp
public class UserRegister {
public string Username { get; set; }
public string Email { get; set; }
public string Password { get; set; }
}
```
## IPermissionOwner
```csharp
public interface IPermissionOwner;
```

25
docs/readme.md Normal file
View File

@@ -0,0 +1,25 @@
# HopFrame Documentation
The HopFrame comes in two variations, you can eiter only use the backend with some basic endpoints or with fully fledged blazor pages for managing HopFrame components.
## Shared HopFrame Modules
- [Database](./database.md)
- [Repositories](./repositories.md)
- [Base Models](./models.md)
## HopFrame Web API
- [Installation](./api/installation.md)
- [Endpoints](./api/endpoints.md)
- [Authorization](./api/authorization.md)
- [Models](./api/models.md)
- [LogicResults](./api/logicresults.md)
## HopFrame Blazor library
- [Installation](./blazor/installation.md)
- [Pages](./blazor/pages.md)
- [Authorization](./blazor/authorization.md)
- [Auth Service](./blazor/auth.md)
- [Admin Context](./blazor/admin.md)