feat: 支持登录、个人信息存储

This commit is contained in:
richarjiang
2026-04-05 13:38:12 +08:00
parent 46368b8c89
commit 9ab78555cb
24 changed files with 3560 additions and 20 deletions

View File

@@ -0,0 +1,29 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { User } from '../entities/user.entity';
import { IUserRepository } from './user.repository.interface';
@Injectable()
export class UserRepository implements IUserRepository {
constructor(
@InjectRepository(User)
private readonly repository: Repository<User>,
) {}
async findById(id: string): Promise<User | null> {
return this.repository.findOne({ where: { id } });
}
async findByOpenid(openid: string): Promise<User | null> {
return this.repository.findOne({ where: { openid } });
}
create(data: Partial<User>): User {
return this.repository.create(data);
}
async save(user: User): Promise<User> {
return this.repository.save(user);
}
}