format + lint

This commit is contained in:
2025-06-14 14:12:18 +08:00
parent e777afc433
commit 90a67b681e
69 changed files with 1756 additions and 1583 deletions

View File

@@ -5,34 +5,34 @@ import { InjectRepository } from '@nestjs/typeorm';
@Injectable()
export class ResourceService {
constructor(
@InjectRepository(Resource)
private readonly resourceRepository: Repository<Resource>,
) { }
constructor(
@InjectRepository(Resource)
private readonly resourceRepository: Repository<Resource>,
) {}
async findAll(): Promise<Resource[]> {
return this.resourceRepository.find({
order: {
createdAt: 'DESC',
}
});
}
async findAll(): Promise<Resource[]> {
return this.resourceRepository.find({
order: {
createdAt: 'DESC',
},
});
}
async findById(id: string): Promise<Resource> {
return this.resourceRepository.findOne({ where: { id } });
}
async findById(id: string): Promise<Resource> {
return this.resourceRepository.findOne({ where: { id } });
}
async create(data: Partial<Resource>): Promise<Resource> {
const resource = this.resourceRepository.create(data);
return this.resourceRepository.save(resource);
}
async create(data: Partial<Resource>): Promise<Resource> {
const resource = this.resourceRepository.create(data);
return this.resourceRepository.save(resource);
}
async update(id: string, data: Partial<Resource>): Promise<Resource> {
await this.resourceRepository.update(id, data);
return this.resourceRepository.findOne({ where: { id } });
}
async update(id: string, data: Partial<Resource>): Promise<Resource> {
await this.resourceRepository.update(id, data);
return this.resourceRepository.findOne({ where: { id } });
}
async delete(id: string): Promise<void> {
await this.resourceRepository.delete(id);
}
async delete(id: string): Promise<void> {
await this.resourceRepository.delete(id);
}
}