managarten/apps-archived/news/apps/api/src/users/users.service.ts
Till-JS 61d181fbc2 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>
2025-11-29 07:03:59 +01:00

47 lines
1.1 KiB
TypeScript

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));
}
}