mirror of
https://github.com/movie-web/backend.git
synced 2025-09-13 10:53:25 +00:00
namespacing
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user