Compare commits
No commits in common. "7700100a7db88c8de86cc60fd65d117fbbdeb8d4" and "fba867e0b538b815d1477f9a0b81a541267fb2a2" have entirely different histories.
7700100a7d
...
fba867e0b5
@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
apps: [
|
|
||||||
{
|
|
||||||
name: 'fennec-be',
|
|
||||||
script: 'npm',
|
|
||||||
args: 'run start:prod',
|
|
||||||
watch: false,
|
|
||||||
ignore_watch: ['node_modules'],
|
|
||||||
log_date_format: 'MM-DD HH:mm:ss.SSS Z',
|
|
||||||
env: {},
|
|
||||||
max_restarts: 5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
20756
package-lock.json
generated
20756
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -26,14 +26,16 @@ export class ArticlesResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mutation(() => Article)
|
@Mutation(() => Article)
|
||||||
async updateArticle(
|
updateArticle(
|
||||||
@Args('updateArticleInput') updateArticleInput: UpdateArticleInput,
|
@Args('updateArticleInput') updateArticleInput: UpdateArticleInput,
|
||||||
) {
|
) {
|
||||||
const article = await this.articlesService.findOne(updateArticleInput.id);
|
return this.articlesService.update(
|
||||||
return this.articlesService.update(article, updateArticleInput);
|
updateArticleInput.id,
|
||||||
|
updateArticleInput,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mutation(() => Int)
|
@Mutation(() => Article)
|
||||||
removeArticle(@Args('id', { type: () => String }) id: string) {
|
removeArticle(@Args('id', { type: () => String }) id: string) {
|
||||||
return this.articlesService.remove(id);
|
return this.articlesService.remove(id);
|
||||||
}
|
}
|
||||||
|
@ -23,20 +23,16 @@ export class ArticlesService extends BaseDbService<Article> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll() {
|
async findAll() {
|
||||||
return await this.repository.find({
|
return await this.repository.find();
|
||||||
order: { createdAt: 'DESC' },
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(article: Article, updateArticleInput: UpdateArticleInput) {
|
async update(id: string, updateArticleInput: UpdateArticleInput) {
|
||||||
await this.isDuplicateEntityForUpdate(article.id, updateArticleInput);
|
await this.isDuplicateEntityForUpdate(id, updateArticleInput);
|
||||||
return await this.repository.save(
|
return await this.repository.update(id, updateArticleInput);
|
||||||
this.repository.merge(article, updateArticleInput),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(id: string) {
|
async remove(id: string) {
|
||||||
await this.canRemove([id]);
|
await this.canRemove([id]);
|
||||||
return await this.repository.softDelete({ id }).then((d) => d.affected);
|
return await this.repository.softDelete({ id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { CreateArticleInput } from './create-article.input';
|
import { CreateArticleInput } from './create-article.input';
|
||||||
import { InputType, Field, PartialType } from '@nestjs/graphql';
|
import { InputType, Field, Int, PartialType } from '@nestjs/graphql';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class UpdateArticleInput extends PartialType(CreateArticleInput) {
|
export class UpdateArticleInput extends PartialType(CreateArticleInput) {
|
||||||
@Field(() => String)
|
@Field(() => Int)
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user