引入Post,新建两个方法:findAll,create
This commit is contained in:
parent
c319205215
commit
b56361bfad
|
@ -1,4 +1,15 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { Post } from 'src/posts/interfaces/post.interface';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DemoService {}
|
export class DemoService {
|
||||||
|
private readonly posts: Post[] = [];
|
||||||
|
|
||||||
|
findAll(): Post[] {
|
||||||
|
return this.posts;
|
||||||
|
}
|
||||||
|
|
||||||
|
create(post: Post) {
|
||||||
|
this.posts.push(post);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue