Skip to content

Commit

Permalink
feat(tour): add CancelTour method
Browse files Browse the repository at this point in the history
Adds a method to cancel a Tour regardless of current state.
TRA-1351
  • Loading branch information
oscarmuhr committed Apr 26, 2024
1 parent 16c0800 commit ff473b2
Show file tree
Hide file tree
Showing 11 changed files with 724 additions and 364 deletions.
367 changes: 227 additions & 140 deletions cmd/saga/gen/einride/saga/extend/book/v1beta1/booking_service.pb.go

Large diffs are not rendered by default.

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

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

89 changes: 47 additions & 42 deletions cmd/saga/gen/einride/saga/extend/book/v1beta1/tour.pb.go

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

24 changes: 24 additions & 0 deletions openapiv2/book.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,28 @@ paths:
pattern: spaces/[^/]+/tours/[^/]+
tags:
- BookingService
/v1beta1/{tour}:cancel:
get:
summary: Cancel a tour.
operationId: BookingService_CancelTour
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1beta1Tour'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: tour
description: The resource name of the tour to cancel.
in: path
required: true
type: string
pattern: spaces/[^/]+/tours/[^/]+
tags:
- BookingService
/v1beta1/{tour}:confirm:
get:
summary: Confirm a Provisional tour.
Expand Down Expand Up @@ -1469,12 +1491,14 @@ definitions:
- PENDING
- ACCEPTED
- REJECTED
- CANCELLED
description: |-
The state of the tour.
- PENDING: The tour is received. Awaiting accept/reject.
- ACCEPTED: The tour is accepted.
- REJECTED: The tour is rejected.
- CANCELLED: The tour is cancelled.
v1beta1Vehicle:
type: object
properties:
Expand Down
25 changes: 25 additions & 0 deletions proto/einride/saga/extend/book/v1beta1/booking_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ service BookingService {
}
};
}

// Cancel a tour.
rpc CancelTour(CancelTourRequest) returns (Tour) {
option (google.api.http) = {get: "/v1beta1/{name=spaces/*/tours/*}:cancel"};
option (google.api.method_signature) = "name";
option (einride.iam.v1.method_authorization) = {
permission: "book.tours.cancel"
before: {
expression: "test(caller, request.name)"
description: "The caller must have permission to cancel the tour"
}
};
}
}

// The request message to create a tour.
Expand Down Expand Up @@ -261,3 +274,15 @@ message UpdateTourRequest {
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
}

// The request message to cancel a tour.
message CancelTourRequest {
// The resource name of the tour to cancel.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.saga.einride.tech/Tour"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "tour"}
}
];
}
2 changes: 2 additions & 0 deletions proto/einride/saga/extend/book/v1beta1/tour.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ message Tour {
ACCEPTED = 2;
// The tour is rejected.
REJECTED = 3;
// The tour is cancelled.
CANCELLED = 4;
}

// The service type of the tour.
Expand Down

0 comments on commit ff473b2

Please sign in to comment.