Add TypeORM DB and Resources (#2)

Co-authored-by: Joe Arndt <jmarndt@users.noreply.github.com>
Reviewed-on: #2
This commit is contained in:
Joe 2026-02-09 00:10:26 +00:00
parent 746adcd2fd
commit c6434de89d
64 changed files with 2916 additions and 360 deletions

View file

@ -0,0 +1,35 @@
import { Injectable } from '@nestjs/common';
import { CreateMerchantDto } from './dto/create-merchant.dto';
import { UpdateMerchantDto } from './dto/update-merchant.dto';
import { MerchantDataService } from './merchant-data.service';
import { Merchant } from './entities/merchant.entity';
@Injectable()
export class MerchantsService {
public constructor(private merchantDataService: MerchantDataService) { }
public async findAll(): Promise<Merchant[]> {
return await this.merchantDataService.getAll();
}
public async findById(id: string): Promise<Merchant> {
const merchant = await this.merchantDataService.getById(id);
if (!merchant) {
throw new Error('Merchant not found.');
}
return merchant;
}
public async create(merchant: CreateMerchantDto): Promise<Merchant> {
return await this.merchantDataService.create(merchant.name);
}
public async update(merchant: UpdateMerchantDto): Promise<Merchant> {
return await this.merchantDataService.update(merchant);
}
public async remove(id: string): Promise<void> {
await this.merchantDataService.delete(id);
}
}