-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Backend API] Implement endpoint for list event details #331
base: main
Are you sure you want to change the base?
[Backend API] Implement endpoint for list event details #331
Conversation
9f9fdec
to
8a943d2
Compare
8a943d2
to
65be6a9
Compare
@praivesi 빌드가 깨집니다. 로컬에서 빌드/테스트 통과했나요? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 이 태스크의 스코프를 벗어난 구현은 추가할 필요가 없습니다.
- 다른 분이 이미 작성한 테스트 코드를 참조해 보세요.
/// <summary> | ||
/// Deletes the event details. | ||
/// </summary> | ||
/// <param name="eventDetails">Event details instance.</param> | ||
/// <returns>Removed EventID of event details instance.</returns> | ||
Task<Guid> DeleteEvent(AdminEventDetails eventDetails); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이벤트를 삭제할 일이 없습니다.
var tableClient = _tableServiceClient.GetTableClient(_storageAccountSettings.TableStorage.TableName); | ||
|
||
await tableClient.AddEntityAsync<AdminEventDetails>(eventDetails); | ||
|
||
return eventDetails; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 태스크는 이벤트 리스트 가져오는 거라 이 메소드는 굳이 구현하실 필요가 없습니다.
await foreach (var entity in tableClient.QueryAsync<AdminEventDetails>()) | ||
{ | ||
eventDetailsList.Add(entity); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테이블에 이벤트 디테일만 들어있는 게 아니라서, 이렇게 하면 에러 날 거예요. 적어도 파티션 키를 넣어줘야 할 겁니다.
|
||
/// <summary> | ||
/// Deletes the event details. | ||
/// </summary> | ||
/// <param name="eventDetails">Event details to update.</param> | ||
/// <returns>Removed EventID of event details instance.</returns> | ||
Task<Guid> DeleteEvent(AdminEventDetails eventDetails); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필요 없습니다.
/// <inheritdoc /> | ||
public async Task<Guid> DeleteEvent(AdminEventDetails eventDetails) | ||
{ | ||
var result = await this._repository.DeleteEvent(eventDetails).ConfigureAwait(false); | ||
|
||
return result; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필요 없습니다
var tableClient = await GetTableClientAsync(); | ||
|
||
eventDetails.EventId = eventId; | ||
|
||
await tableClient.UpdateEntityAsync<AdminEventDetails>(eventDetails, eventDetails.ETag, TableUpdateMode.Replace); | ||
|
||
return eventDetails; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마찬가지로 이 태스크의 스코프를 벗어난 구현입니다.
public async Task<Guid> DeleteEvent(AdminEventDetails eventDetails) | ||
{ | ||
var tableClient = await GetTableClientAsync(); | ||
|
||
await tableClient.DeleteEntityAsync(eventDetails.PartitionKey, eventDetails.RowKey); | ||
|
||
return eventDetails.EventId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
필요 없습니다.
private readonly StorageAccountSettings mockSettings; | ||
private readonly TableServiceClient mockTableServiceClient; | ||
private readonly TableClient mockTableClient; | ||
|
||
public AdminEventRepositoryTests() | ||
{ | ||
mockSettings = Substitute.For<StorageAccountSettings>(); | ||
mockTableServiceClient = Substitute.For<TableServiceClient>(); | ||
mockTableClient = Substitute.For<TableClient>(); | ||
|
||
mockTableServiceClient.GetTableClient(Arg.Any<string>()).Returns(mockTableClient); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 코드는 이렇게 작성하면 안될 거예요.
작업중인 이슈
#218
작업 내용
궁금한 점
AdminEventRepository 클래스의 UpdateEvent() 함수가 EventId 파라미터를 전달 받도록 기존 인터페이스가 작성되어 있었는데,
이 EventId를 꼭 전달해주어야 하는지 궁금합니다.
EventId와 함께 전달되는 AdminEventDetails 객체에 이미 EventId 필드가 있기 때문에 중복되는 것 같기도 해서요.