mirror of
https://github.com/p-stream/backend.git
synced 2026-03-11 17:55:35 +00:00
namespacing
This commit is contained in:
parent
e9f8845506
commit
1f85631f55
3 changed files with 8 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ Backend for movie-web
|
|||
- [ ] ratelimits (stored in redis)
|
||||
- [X] switch to pnpm
|
||||
- [X] catpcha support
|
||||
- [ ] global namespacing (accounts are stored on a namespace)
|
||||
- [X] global namespacing (accounts are stored on a namespace)
|
||||
- [ ] cleanup jobs
|
||||
- [ ] cleanup expired sessions
|
||||
- [ ] cleanup old metrics
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ export class User {
|
|||
@PrimaryKey({ name: 'id', type: 'uuid' })
|
||||
id: string = randomUUID();
|
||||
|
||||
@Property({ name: 'namespace' })
|
||||
namespace!: string;
|
||||
|
||||
@Property({ type: 'date' })
|
||||
createdAt: Date = new Date();
|
||||
|
||||
|
|
@ -30,6 +33,7 @@ export class User {
|
|||
|
||||
export interface UserDTO {
|
||||
id: string;
|
||||
namespace: string;
|
||||
name: string;
|
||||
roles: string[];
|
||||
createdAt: string;
|
||||
|
|
@ -43,6 +47,7 @@ export interface UserDTO {
|
|||
export function formatUser(user: User): UserDTO {
|
||||
return {
|
||||
id: user.id,
|
||||
namespace: user.namespace,
|
||||
name: user.name,
|
||||
roles: user.roles,
|
||||
createdAt: user.createdAt.toISOString(),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { makeSession, makeSessionToken } from '@/services/session';
|
|||
import { z } from 'zod';
|
||||
|
||||
const registerSchema = z.object({
|
||||
namespace: z.string().min(1),
|
||||
name: z.string().max(500).min(1),
|
||||
device: z.string().max(500).min(1),
|
||||
profile: z.object({
|
||||
|
|
@ -25,6 +26,7 @@ export const manageAuthRouter = makeRouter((app) => {
|
|||
await assertCaptcha(body.captchaToken);
|
||||
|
||||
const user = new User();
|
||||
user.namespace = body.namespace;
|
||||
user.name = body.name;
|
||||
user.profile = body.profile;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue