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

knoQのdescriptionを扱わない #609

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/swagger/traPortfolio.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,6 @@ components:
allOf:
- $ref: "#/components/schemas/Event"
- properties:
description:
type: string
example: 第n回の進捗会です。
description: イベント説明
place:
type: string
description: 大学、オンラインなどの大まかな場所
Expand Down
19 changes: 9 additions & 10 deletions infrastructure/external/knoq.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ import (
)

type EventResponse struct {
ID uuid.UUID `json:"eventId"`
Name string `json:"name"`
Description string `json:"description"`
Place string `json:"place"`
GroupID uuid.UUID `json:"groupId"`
RoomID uuid.UUID `json:"roomId"`
TimeStart time.Time `json:"timeStart"`
TimeEnd time.Time `json:"timeEnd"`
SharedRoom bool `json:"sharedRoom"`
Admins []uuid.UUID `json:"admins"`
ID uuid.UUID `json:"eventId"`
Name string `json:"name"`
Place string `json:"place"`
GroupID uuid.UUID `json:"groupId"`
RoomID uuid.UUID `json:"roomId"`
TimeStart time.Time `json:"timeStart"`
TimeEnd time.Time `json:"timeEnd"`
SharedRoom bool `json:"sharedRoom"`
Admins []uuid.UUID `json:"admins"`
}

type KnoqAPI interface {
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/repository/event_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ func (r *EventRepository) GetEvent(ctx context.Context, eventID uuid.UUID) (*dom
hostName = append(hostName, &domain.User{ID: aid})
}

// Descriptionはknoqからの情報を使わず、空文字でおく
ed := domain.EventDetail{
Event: domain.Event{
ID: er.ID,
Name: er.Name,
TimeStart: er.TimeStart,
TimeEnd: er.TimeEnd,
},
Description: er.Description,
Description: "",
Place: er.Place,
// Level:
HostName: hostName,
Expand Down
40 changes: 20 additions & 20 deletions infrastructure/repository/event_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestEventRepository_GetEvent(t *testing.T) {
Place: random.AlphaNumeric(),
Level: domain.EventLevelPublic,
HostName: []*domain.User{{ID: random.UUID()}},
Description: random.AlphaNumeric(),
Description: "",
GroupID: random.UUID(),
RoomID: random.UUID(),
},
Expand Down Expand Up @@ -167,7 +167,7 @@ func TestEventRepository_GetEvent(t *testing.T) {
Place: random.AlphaNumeric(),
Level: domain.EventLevelAnonymous,
HostName: nil,
Description: random.AlphaNumeric(),
Description: "",
GroupID: random.UUID(),
RoomID: random.UUID(),
},
Expand Down Expand Up @@ -248,15 +248,15 @@ func TestEventRepository_CreateEventLevel(t *testing.T) {
setup: func(f mockEventRepositoryFields, args args) {
since, until := random.SinceAndUntil()
event := external.EventResponse{
ID: args.args.EventID,
Name: random.AlphaNumeric(),
Description: random.AlphaNumeric(),
Place: random.AlphaNumeric(),
GroupID: random.UUID(),
RoomID: random.UUID(),
TimeStart: since,
TimeEnd: until,
SharedRoom: random.Bool(),
ID: args.args.EventID,
Name: random.AlphaNumeric(),
// Description: random.AlphaNumeric(),
Place: random.AlphaNumeric(),
GroupID: random.UUID(),
RoomID: random.UUID(),
TimeStart: since,
TimeEnd: until,
SharedRoom: random.Bool(),
}
f.knoq.EXPECT().GetEvent(args.args.EventID).Return(&event, nil)
f.h.Mock.ExpectBegin()
Expand Down Expand Up @@ -291,15 +291,15 @@ func TestEventRepository_CreateEventLevel(t *testing.T) {
setup: func(f mockEventRepositoryFields, args args) {
since, until := random.SinceAndUntil()
event := external.EventResponse{
ID: args.args.EventID,
Name: random.AlphaNumeric(),
Description: random.AlphaNumeric(),
Place: random.AlphaNumeric(),
GroupID: random.UUID(),
RoomID: random.UUID(),
TimeStart: since,
TimeEnd: until,
SharedRoom: random.Bool(),
ID: args.args.EventID,
Name: random.AlphaNumeric(),
// Description: random.AlphaNumeric(),
Place: random.AlphaNumeric(),
GroupID: random.UUID(),
RoomID: random.UUID(),
TimeStart: since,
TimeEnd: until,
SharedRoom: random.Bool(),
}
f.knoq.EXPECT().GetEvent(args.args.EventID).Return(&event, nil)
f.h.Mock.ExpectBegin()
Expand Down
17 changes: 8 additions & 9 deletions infrastructure/repository/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,14 @@ func makeKnoqEvent(t *testing.T, event *domain.EventDetail) *external.EventRespo
}

return &external.EventResponse{
ID: event.ID,
Name: event.Name,
Description: event.Description,
Place: event.Place,
GroupID: event.GroupID,
RoomID: event.RoomID,
TimeStart: event.TimeStart,
TimeEnd: event.TimeEnd,
Admins: admins,
ID: event.ID,
Name: event.Name,
Place: event.Place,
GroupID: event.GroupID,
RoomID: event.RoomID,
TimeStart: event.TimeStart,
TimeEnd: event.TimeEnd,
Admins: admins,
}
}

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/repository/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestEventRepository_GetEvent(t *testing.T) {
TimeStart: selected.TimeStart,
TimeEnd: selected.TimeEnd,
},
Description: selected.Description,
Description: "",
Place: selected.Place,
Level: level,
HostName: hostName,
Expand Down
1 change: 0 additions & 1 deletion interfaces/handler/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func newEvent(id uuid.UUID, name string, since time.Time, until time.Time) schem

func newEventDetail(event schema.Event, description string, eventLevel domain.EventLevel, hostname []schema.User, place string) schema.EventDetail {
return schema.EventDetail{
Description: description,
Duration: schema.Duration{
Since: event.Duration.Since,
Until: event.Duration.Until,
Expand Down
1 change: 0 additions & 1 deletion interfaces/handler/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func TestEventHandler_GetEvent(t *testing.T) {
}

hevent := schema.EventDetail{
Description: revent.Description,
Duration: schema.Duration{
Since: revent.Event.TimeStart,
Until: &revent.Event.TimeEnd,
Expand Down
3 changes: 0 additions & 3 deletions interfaces/handler/schema/schema_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 24 additions & 27 deletions util/mockdata/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,42 @@ var (
func CloneMockKnoqEvents() []*external.EventResponse {
return []*external.EventResponse{
{
ID: KnoqEventID1(),
Name: "第n回進捗回",
Description: "第n回の進捗会です。",
Place: "S516",
GroupID: KnoqEventGroupID1(),
RoomID: KnoqEventRoomID1(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: true,
ID: KnoqEventID1(),
Name: "第n回進捗回",
Place: "S516",
GroupID: KnoqEventGroupID1(),
RoomID: KnoqEventRoomID1(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: true,
Admins: []uuid.UUID{
UserID1(),
},
},
{
ID: KnoqEventID2(),
Name: "sample event",
Description: "This is a sample event.",
Place: "S516",
GroupID: KnoqEventGroupID2(),
RoomID: KnoqEventRoomID2(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: false,
ID: KnoqEventID2(),
Name: "sample event",
Place: "S516",
GroupID: KnoqEventGroupID2(),
RoomID: KnoqEventRoomID2(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: false,
Admins: []uuid.UUID{
UserID1(),
UserID2(),
UserID3(),
},
},
{
ID: KnoqEventID3(),
Name: "sample event",
Description: "This is a sample event.",
Place: "S516",
GroupID: KnoqEventGroupID3(),
RoomID: KnoqEventRoomID3(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: false,
ID: KnoqEventID3(),
Name: "sample event",
Place: "S516",
GroupID: KnoqEventGroupID3(),
RoomID: KnoqEventRoomID3(),
TimeStart: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2020, 1, 2, 0, 0, 0, 0, time.UTC),
SharedRoom: false,
Admins: []uuid.UUID{
UserID2(),
},
Expand Down
1 change: 0 additions & 1 deletion util/mockdata/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func CloneHandlerMockEventDetails() []schema.EventDetail {
}

event := schema.EventDetail{
Description: e.Description,
Duration: schema.Duration{
Since: e.TimeStart,
Until: &e.TimeEnd,
Expand Down