Skip to content

Commit 77f31cf

Browse files
committed
remove update method on elastic repository
1 parent 95bf5d6 commit 77f31cf

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

src/Contexts/Backoffice/Courses/infrastructure/persistence/ElasticBackofficeCourseRepository.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export class ElasticBackofficeCourseRepository
1111
}
1212

1313
async save(course: BackofficeCourse): Promise<void> {
14-
const currentCourse = await this.findById(course.id.value, BackofficeCourse.fromPrimitives);
15-
if (currentCourse) {
16-
return this.update(course.id.value, course);
17-
}
18-
1914
return this.persist(course.id.value, course);
2015
}
2116

src/Contexts/Shared/infrastructure/persistence/elasticsearch/ElasticRepository.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import bodybuilder, { Bodybuilder } from 'bodybuilder';
44
import httpStatus from 'http-status';
55
import { AggregateRoot } from '../../../domain/AggregateRoot';
66
import { Criteria } from '../../../domain/criteria/Criteria';
7-
import { Nullable } from '../../../domain/Nullable';
87
import ElasticConfig from './ElasticConfig';
98
import { ElasticCriteriaConverter, TypeQueryEnum } from './ElasticCriteriaConverter';
109

@@ -65,24 +64,4 @@ export abstract class ElasticRepository<T extends AggregateRoot> {
6564

6665
await client.index({ index: this.indexName(), id, body: document, refresh: 'wait_for' }); // wait_for wait for a refresh to make this operation visible to search
6766
}
68-
69-
update(id: string, course: T): Promise<void> {
70-
return this.persist(id, course);
71-
}
72-
73-
protected async findById(id: string, unserializer: (data: any) => T): Promise<Nullable<T>> {
74-
const client = await this.client();
75-
try {
76-
const { body } = await client.get({
77-
index: this.indexName(),
78-
id
79-
});
80-
return unserializer(body._source);
81-
} catch (e) {
82-
if (this.isNotFoundError(e)) {
83-
return null;
84-
}
85-
throw e;
86-
}
87-
}
8867
}

0 commit comments

Comments
 (0)