-
-
{{ character.name }}
-
-
-
Niveau {{ character.level }}
-
-
{{ config.peoples[character.people!]?.name }}
+
+
+
+
+
+
+
{{ character.name }}
+
+
+ Niveau {{ character.level }}
+
+ {{ config.peoples[character.people!]?.name }}
+
+
-
-
-
+
+
-
+
+ Il n'existe pas encore de personnage public
+ Soyez le premier à partager vos créations !
+ Nouveau personnage
+
+
Erreur de chargement
{{ error?.message }}
diff --git a/server/api/auth/register.post.ts b/server/api/auth/register.post.ts
index 2d814c1..0cc6b3f 100644
--- a/server/api/auth/register.post.ts
+++ b/server/api/auth/register.post.ts
@@ -5,7 +5,6 @@ import { usersDataTable, usersTable } from '~/db/schema';
import { schema } from '~/schemas/registration';
import { checkSession, logSession } from '~/server/utils/user';
import type { UserSession, UserSessionRequired } from '~/types/auth';
-import sendMail from '~/server/tasks/mail';
import type { $ZodIssue } from 'zod/v4/core';
interface SuccessHandler
@@ -84,7 +83,7 @@ export default defineEventHandler(async (e): Promise => {
id: emailId, timestamp,
}
});
- await sendMail({
+ await runTask('mail', {
payload: {
type: 'mail',
to: [body.data.email],
diff --git a/server/api/character.get.ts b/server/api/character.get.ts
index 9b362d4..335c9e5 100644
--- a/server/api/character.get.ts
+++ b/server/api/character.get.ts
@@ -16,9 +16,9 @@ export default defineEventHandler(async (e) => {
let where: ((character: typeof characterTable._.config.columns, sql: Operators) => SQL | undefined) | undefined = undefined;
const db = useDatabase();
+ const session = await getUserSession(e);
if(visibility === "own")
{
- const session = await getUserSession(e);
if(!session.user)
{
setResponseStatus(e, 401);
@@ -33,7 +33,6 @@ export default defineEventHandler(async (e) => {
}
else if(visibility === 'admin')
{
- const session = await getUserSession(e);
if(!session.user)
{
setResponseStatus(e, 401);
@@ -73,7 +72,7 @@ export default defineEventHandler(async (e) => {
people: character.people,
level: character.level,
aspect: character.aspect,
- notes: character.notes,
+ notes: { public: character.public_notes, private: session.user?.id === character.owner ? character.private_notes : undefined },
variables: character.variables,
training: character.training.reduce((p, v) => { p[v.stat] ??= {}; p[v.stat][v.level as TrainingLevel] = v.choice; return p; }, {} as Record>>),
diff --git a/server/api/character.post.ts b/server/api/character.post.ts
index f4eef9e..5339f1d 100644
--- a/server/api/character.post.ts
+++ b/server/api/character.post.ts
@@ -31,7 +31,8 @@ export default defineEventHandler(async (e) => {
people: body.data.people!,
level: body.data.level,
aspect: body.data.aspect,
- notes: body.data.notes,
+ public_notes: body.data.notes.public,
+ private_notes: body.data.notes.private,
variables: body.data.variables,
visibility: body.data.visibility,
thumbnail: body.data.thumbnail,
diff --git a/server/api/character/[id].get.ts b/server/api/character/[id].get.ts
index 6ab7cfb..4ab44f9 100644
--- a/server/api/character/[id].get.ts
+++ b/server/api/character/[id].get.ts
@@ -43,7 +43,7 @@ export default defineEventHandler(async (e) => {
people: character.people,
level: character.level,
aspect: character.aspect,
- notes: { public: character.public_notes, private: character.private_notes },
+ notes: { public: character.public_notes, private: session.user?.id === character.owner ? character.private_notes : undefined },
variables: character.variables,
training: character.training.reduce((p, v) => { p[v.stat] ??= {}; p[v.stat][v.level as TrainingLevel] = v.choice; return p; }, {} as Record>>),