renaming and docs
This commit is contained in:
parent
b1b714f44e
commit
7e831cfb64
14 changed files with 86 additions and 32 deletions
|
|
@ -2,6 +2,9 @@ import { Repository, DeepPartial } from "typeorm";
|
|||
import { AppDataSource } from "../data-source.js";
|
||||
import { AbstractEntity } from "../entities/AbstractEntity.js";
|
||||
|
||||
/**
|
||||
* Basic methods for saving, loading and deleting data
|
||||
*/
|
||||
export abstract class AbstractRepository<T extends AbstractEntity> {
|
||||
protected repo: Repository<T>;
|
||||
|
||||
|
|
@ -22,15 +25,6 @@ export abstract class AbstractRepository<T extends AbstractEntity> {
|
|||
return this.repo.save(entity);
|
||||
}
|
||||
|
||||
/* async update(id: string, partialData: DeepPartial<T>): Promise<T> {
|
||||
await this.repo.update(id as any, partialData);
|
||||
const updated = await this.findById(id);
|
||||
if (!updated) {
|
||||
throw new Error("Entity not found after update");
|
||||
}
|
||||
return updated;
|
||||
} */
|
||||
|
||||
async delete(id: string): Promise<void> {
|
||||
await this.repo.delete(id as any);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue