Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

praivesi
Copy link
Contributor

@praivesi praivesi commented Sep 28, 2024

작업중인 이슈

#218

작업 내용

  1. AdminEventRepository 클래스의 CreateEvent(), GetEvents(), UpdateEvent(), DeleteEvent() 기능 구현
  2. AdminEventRepositoryTests 클래스에서 구현 안되었던 테스트 코드 구현
  3. AdminEventService 클래스의 UpdateEvent(), DeleteEvent() 기능 구현
  4. AdminEventServiceTests 클래스에서 구현 안되었던 테스트 코드 구현

궁금한 점

AdminEventRepository 클래스의 UpdateEvent() 함수가 EventId 파라미터를 전달 받도록 기존 인터페이스가 작성되어 있었는데,
이 EventId를 꼭 전달해주어야 하는지 궁금합니다.
EventId와 함께 전달되는 AdminEventDetails 객체에 이미 EventId 필드가 있기 때문에 중복되는 것 같기도 해서요.

@praivesi praivesi force-pushed the task/218-backend-api-list-events branch from 9f9fdec to 8a943d2 Compare September 28, 2024 05:31
@praivesi praivesi force-pushed the task/218-backend-api-list-events branch from 8a943d2 to 65be6a9 Compare September 28, 2024 05:37
@praivesi praivesi changed the title Task/218 backend api list events [Backend API] Implement endpoint for list event details Sep 29, 2024
@justinyoo justinyoo linked an issue Oct 2, 2024 that may be closed by this pull request
@justinyoo
Copy link
Contributor

@praivesi 빌드가 깨집니다. 로컬에서 빌드/테스트 통과했나요?

Copy link
Contributor

@justinyoo justinyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 이 태스크의 스코프를 벗어난 구현은 추가할 필요가 없습니다.
  • 다른 분이 이미 작성한 테스트 코드를 참조해 보세요.

Comment on lines +45 to +50
/// <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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이벤트를 삭제할 일이 없습니다.

Comment on lines +64 to +68
var tableClient = _tableServiceClient.GetTableClient(_storageAccountSettings.TableStorage.TableName);

await tableClient.AddEntityAsync<AdminEventDetails>(eventDetails);

return eventDetails;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 태스크는 이벤트 리스트 가져오는 거라 이 메소드는 굳이 구현하실 필요가 없습니다.

Comment on lines +77 to +80
await foreach (var entity in tableClient.QueryAsync<AdminEventDetails>())
{
eventDetailsList.Add(entity);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테이블에 이벤트 디테일만 들어있는 게 아니라서, 이렇게 하면 에러 날 거예요. 적어도 파티션 키를 넣어줘야 할 겁니다.

Comment on lines +38 to +44

/// <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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요 없습니다.

Comment on lines +86 to +92
/// <inheritdoc />
public async Task<Guid> DeleteEvent(AdminEventDetails eventDetails)
{
var result = await this._repository.DeleteEvent(eventDetails).ConfigureAwait(false);

return result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요 없습니다

Comment on lines +101 to +107
var tableClient = await GetTableClientAsync();

eventDetails.EventId = eventId;

await tableClient.UpdateEntityAsync<AdminEventDetails>(eventDetails, eventDetails.ETag, TableUpdateMode.Replace);

return eventDetails;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

마찬가지로 이 태스크의 스코프를 벗어난 구현입니다.

Comment on lines +110 to +116
public async Task<Guid> DeleteEvent(AdminEventDetails eventDetails)
{
var tableClient = await GetTableClientAsync();

await tableClient.DeleteEntityAsync(eventDetails.PartitionKey, eventDetails.RowKey);

return eventDetails.EventId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요 없습니다.

Comment on lines +19 to +30
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);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 코드는 이렇게 작성하면 안될 거예요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Backend API] Implement endpoint for list event details
2 participants