66aeab282c
Build and Push Multi-Platform Images / build-and-push (push) Successful in 19s
This reverts commit 07dfd7e840.
36 lines
1005 B
TypeScript
36 lines
1005 B
TypeScript
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { Kontonummer } from '../database/entities';
|
|
|
|
@Injectable()
|
|
export class KontonummernService {
|
|
constructor(
|
|
@InjectRepository(Kontonummer)
|
|
private readonly kontonummerRepo: Repository<Kontonummer>,
|
|
) {}
|
|
|
|
async findByCorrespondent(correspondentId: number): Promise<Kontonummer[]> {
|
|
return this.kontonummerRepo.find({
|
|
where: { CorrespondentId: correspondentId },
|
|
});
|
|
}
|
|
|
|
async create(correspondentId: number, nummer: string): Promise<Kontonummer> {
|
|
const existing = await this.kontonummerRepo.findOne({
|
|
where: { CorrespondentId: correspondentId, Nummer: nummer },
|
|
});
|
|
|
|
if (existing) {
|
|
return existing;
|
|
}
|
|
|
|
const kontonummer = this.kontonummerRepo.create({
|
|
CorrespondentId: correspondentId,
|
|
Nummer: nummer,
|
|
});
|
|
|
|
return this.kontonummerRepo.save(kontonummer);
|
|
}
|
|
}
|