mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 03:46:41 +02:00
chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace: - bauntown (community website) - maerchenzauber (AI story generation) - memoro (voice memo app) - news (news aggregation) - nutriphi (nutrition tracking) - reader (reading app) - uload (URL shortener) - wisekeep (AI wisdom extraction) Update CLAUDE.md documentation: - Add presi to active projects - Document archived projects section - Update workspace configuration Archived apps can be re-activated by moving back to apps/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b97149ac12
commit
61d181fbc2
3148 changed files with 437 additions and 46640 deletions
88
apps-archived/news/apps/api/src/auth/auth.controller.ts
Normal file
88
apps-archived/news/apps/api/src/auth/auth.controller.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
import { Controller, Post, Get, Body, Headers, UnauthorizedException } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { IsEmail, IsString, MinLength, IsOptional } from 'class-validator';
|
||||
|
||||
class SignUpDto {
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsString()
|
||||
@MinLength(6)
|
||||
password: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
}
|
||||
|
||||
class SignInDto {
|
||||
@IsEmail()
|
||||
email: string;
|
||||
|
||||
@IsString()
|
||||
password: string;
|
||||
}
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private authService: AuthService) {}
|
||||
|
||||
@Post('signup')
|
||||
async signUp(@Body() body: SignUpDto) {
|
||||
const result = await this.authService.signUp(body.email, body.password, body.name);
|
||||
return {
|
||||
user: {
|
||||
id: result.user.id,
|
||||
email: result.user.email,
|
||||
name: result.user.name,
|
||||
},
|
||||
token: result.token,
|
||||
};
|
||||
}
|
||||
|
||||
@Post('signin')
|
||||
async signIn(@Body() body: SignInDto) {
|
||||
const result = await this.authService.signIn(body.email, body.password);
|
||||
return {
|
||||
user: {
|
||||
id: result.user.id,
|
||||
email: result.user.email,
|
||||
name: result.user.name,
|
||||
},
|
||||
token: result.token,
|
||||
};
|
||||
}
|
||||
|
||||
@Post('signout')
|
||||
async signOut(@Headers('authorization') authHeader: string) {
|
||||
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
||||
throw new UnauthorizedException('No token provided');
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7);
|
||||
await this.authService.signOut(token);
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
@Get('session')
|
||||
async getSession(@Headers('authorization') authHeader: string) {
|
||||
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
||||
throw new UnauthorizedException('No token provided');
|
||||
}
|
||||
|
||||
const token = authHeader.substring(7);
|
||||
const session = await this.authService.getSession(token);
|
||||
|
||||
if (!session) {
|
||||
throw new UnauthorizedException('Invalid or expired session');
|
||||
}
|
||||
|
||||
return {
|
||||
user: {
|
||||
id: session.user.id,
|
||||
email: session.user.email,
|
||||
name: session.user.name,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue