mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-25 05:14:39 +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
56
apps-archived/news/apps/api/src/users/users.controller.ts
Normal file
56
apps-archived/news/apps/api/src/users/users.controller.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import { Controller, Get, Patch, Body, UseGuards } from '@nestjs/common';
|
||||
import { UsersService } from './users.service';
|
||||
import { AuthGuard } from '../common/guards/auth.guard';
|
||||
import { CurrentUser } from '../common/decorators/current-user.decorator';
|
||||
import { User } from '@manacore/news-database';
|
||||
import { IsOptional, IsString, IsArray, IsEnum, IsBoolean } from 'class-validator';
|
||||
|
||||
class UpdateUserDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
preferredCategories?: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
blockedSources?: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(['slow', 'normal', 'fast'])
|
||||
readingSpeed?: 'slow' | 'normal' | 'fast';
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
notificationSettings?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
onboardingCompleted?: boolean;
|
||||
}
|
||||
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
constructor(private usersService: UsersService) {}
|
||||
|
||||
@Get('me')
|
||||
@UseGuards(AuthGuard)
|
||||
async getCurrentUser(@CurrentUser() user: User) {
|
||||
return this.usersService.getUserById(user.id);
|
||||
}
|
||||
|
||||
@Patch('me')
|
||||
@UseGuards(AuthGuard)
|
||||
async updateCurrentUser(@CurrentUser() user: User, @Body() body: UpdateUserDto) {
|
||||
return this.usersService.updateUser(user.id, body);
|
||||
}
|
||||
|
||||
@Patch('me/onboarding')
|
||||
@UseGuards(AuthGuard)
|
||||
async completeOnboarding(@CurrentUser() user: User) {
|
||||
await this.usersService.completeOnboarding(user.id);
|
||||
return { success: true };
|
||||
}
|
||||
}
|
||||
12
apps-archived/news/apps/api/src/users/users.module.ts
Normal file
12
apps-archived/news/apps/api/src/users/users.module.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { UsersController } from './users.controller';
|
||||
import { UsersService } from './users.service';
|
||||
import { AuthModule } from '../auth/auth.module';
|
||||
|
||||
@Module({
|
||||
imports: [AuthModule],
|
||||
controllers: [UsersController],
|
||||
providers: [UsersService],
|
||||
exports: [UsersService],
|
||||
})
|
||||
export class UsersModule {}
|
||||
47
apps-archived/news/apps/api/src/users/users.service.ts
Normal file
47
apps-archived/news/apps/api/src/users/users.service.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { DATABASE_CONNECTION } from '../database/database.module';
|
||||
import { Database, users, User, eq } from '@manacore/news-database';
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(@Inject(DATABASE_CONNECTION) private database: Database) {}
|
||||
|
||||
async getUserById(userId: string): Promise<User | null> {
|
||||
const [user] = await this.database.select().from(users).where(eq(users.id, userId)).limit(1);
|
||||
|
||||
return user || null;
|
||||
}
|
||||
|
||||
async updateUser(
|
||||
userId: string,
|
||||
data: {
|
||||
name?: string;
|
||||
preferredCategories?: string[];
|
||||
blockedSources?: string[];
|
||||
readingSpeed?: 'slow' | 'normal' | 'fast';
|
||||
notificationSettings?: string;
|
||||
onboardingCompleted?: boolean;
|
||||
}
|
||||
): Promise<User> {
|
||||
const [user] = await this.database
|
||||
.update(users)
|
||||
.set({
|
||||
...data,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.where(eq(users.id, userId))
|
||||
.returning();
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
async completeOnboarding(userId: string): Promise<void> {
|
||||
await this.database
|
||||
.update(users)
|
||||
.set({
|
||||
onboardingCompleted: true,
|
||||
updatedAt: new Date(),
|
||||
})
|
||||
.where(eq(users.id, userId));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue