mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
chore(deps): update typeorm
This commit is contained in:
parent
9900bc641d
commit
ef84800ce8
22 changed files with 232 additions and 242 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { EntityRepository, Repository } from "typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { EntityRepository } from "../database/entity-repository";
|
||||
import { User } from "./user.entity";
|
||||
|
||||
@EntityRepository(User)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { Module } from "@nestjs/common";
|
||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||
import { UserRepository } from "./user.repository";
|
||||
import { UsersService } from "./users.service";
|
||||
import { UsersController } from "./users.controller";
|
||||
import { TypeOrmRepositoryModule } from "../database/entity-repository/typeorm-repository.module";
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([UserRepository])],
|
||||
imports: [TypeOrmRepositoryModule.for([UserRepository])],
|
||||
providers: [UsersService],
|
||||
exports: [UsersService],
|
||||
controllers: [UsersController],
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export class UsersService {
|
|||
constructor(private readonly userRepository: UserRepository) {}
|
||||
|
||||
async findById(id: string): Promise<User> {
|
||||
const user = await this.userRepository.findOne(id);
|
||||
const user = await this.userRepository.findOneBy({ id });
|
||||
|
||||
if (!user) {
|
||||
throw new NotFoundException("UserNotFound");
|
||||
|
|
@ -23,8 +23,8 @@ export class UsersService {
|
|||
}
|
||||
|
||||
async createOrUpdate(data: CreateOrUpdateDto): Promise<User> {
|
||||
let user = await this.userRepository.findOne({
|
||||
where: { spotify: { id: data.spotify.id } },
|
||||
let user = await this.userRepository.findOneBy({
|
||||
spotify: { id: data.spotify.id },
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue