fix client to api dtos again
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 7s
Build and Deploy API / build-and-deploy (push) Successful in 9s

This commit is contained in:
2026-03-21 17:41:11 -05:00
parent fc064dd01c
commit 4fe23699c8
9 changed files with 36 additions and 20 deletions

View File

@@ -45,7 +45,7 @@ public class AuthController : ControllerBase {
[HttpPost("login")]
public async Task<ActionResult> Login(LoginDto dto)
{
var user = await users_.Get(dto.UserName);
var user = await userManager_.FindByNameAsync(dto.UserName);
if (user == null) return Unauthorized();

View File

@@ -21,7 +21,7 @@ onMounted(() => { // register callback for when component is loaded on page
<table>
<tr v-for="user in store.users" :key="user.id">
<td>{{ user.name }}</td>
<td>{{ user.username }}</td>
<td>
<router-link :to="`/user/${user.id}`">Edit</router-link>
<button @click="store.removeUser(user.id)">Delete</button>

View File

@@ -4,18 +4,18 @@
export interface User {
id: number;
name: string;
username: string;
email: string;
password: string;
}
export interface RegisterDto {
name: string;
username: string;
email: string;
password: string;
}
export interface LoginDto {
name: string;
username: string;
password: string;
}

View File

@@ -10,7 +10,7 @@ import * as authApi from "../api/AuthApi";
const router = useRouter();
const user = reactive<LoginDto>({ // the template ensures type consistency
name: "",
username: "",
password: "",
});
@@ -38,7 +38,7 @@ async function login(): Promise<void> {
<h2>Login</h2>
<form @submit.prevent="login">
<input v-model="user.name" placeholder="username" />
<input v-model="user.username" placeholder="username" />
<input v-model="user.password" type="password" placeholder="password" />
<button type="submit">Submit</button>

View File

@@ -10,7 +10,7 @@ import * as authApi from "../api/AuthApi";
const router = useRouter();
const user = reactive<RegisterDto>({ // the template ensures type consistency
name: "",
username: "",
email: "",
password: "",
});
@@ -40,7 +40,7 @@ async function register(): Promise<void> {
<h2>Register</h2>
<form @submit.prevent="register">
<input v-model="user.name" placeholder="username" />
<input v-model="user.username" placeholder="username" />
<input v-model="user.email" placeholder="email" />
<input v-model="user.password" placeholder="password" />

View File

@@ -14,7 +14,7 @@ const router = useRouter();
const user = ref<User>({
id: 0,
name: "",
username: "",
email: "",
password: ""
});
@@ -46,7 +46,7 @@ async function save(): Promise<void> {
<h2>{{ id ? "Edit User" : "Create User" }}</h2> <!-- omg I love ternary operator :D -->
<form @submit.prevent="save">
<input v-model="user.name" placeholder="Name" />
<input v-model="user.username" placeholder="Name" />
<button type="submit">Save</button>
</form>

View File

@@ -28,7 +28,7 @@ function logout() {
<table>
<tr v-for="user in store.users" :key="user.id">
<td>{{ user.name }}</td>
<td>{{ user.username }}</td>
<td>
<router-link :to="`/user/${user.id}`" custom v-slot="{ navigate }">

24
scripts/DEV_README.md Normal file
View File

@@ -0,0 +1,24 @@
## These are some notes for development
# contains some helpful tips, commands, and knowledge
Resetting the database (for dev):
> set development evironment (specify non-docker network and db password)
> dotnet ef database drop
> dotnet ef migrations remove
> if above errors, dotnet ef database update 0
> dotnet ef migrations add InitialCreate
To see live logs:
sudo docker logs -f -t agologum-api
public user:
> username=bard
> password=Public*890
chrome dev tools troubleshooting
> response body: Network => url endpoint => Response => expand
Always test build before committing
> for the client: $ npm run dev
> for the api: $ dotnet build

View File

@@ -1,8 +0,0 @@
Resetting the database (for dev):
> set development evironment (specify non-docker network and db password)
> dotnet ef database drop
> dotnet ef migrations remove
> if above errors, dotnet ef database update 0
> dotnet ef migrations add InitialCreate