添加博客模块

This commit is contained in:
2025-05-07 18:33:13 +08:00
parent 9e09a7bc72
commit 464931cc98
7 changed files with 121 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Blog } from './entity/Blog.entity';
import { Repository } from 'typeorm';
@Injectable()
export class BlogService {
constructor(
@InjectRepository(Blog)
private readonly blogRepository: Repository<Blog>,
) { }
async list() {
return this.blogRepository.find({
where: { deletedAt: null },
order: {
publishAt: 'DESC',
}
})
}
}