mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 05:46:42 +02:00
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>
47 lines
1.1 KiB
TypeScript
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));
|
|
}
|
|
}
|