-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: transaction crud #1432
feat: transaction crud #1432
Conversation
6998ddf
to
6180a55
Compare
6348668
to
078df29
Compare
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.
left 2 nits, but should be good to go!
step_number int NOT NULL, | ||
|
||
CONSTRAINT transaction_steps_transactions_fk | ||
FOREIGN KEY (transaction_id, transaction_version) REFERENCES transactions(id, "version") |
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.
don't you need an fk here to the tests table?
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.
Thing is that the PK of tests are id
and version
. But as we discussed a couple of days ago, we are always going to use the latest version available. So I decided to not keep the fk here
{ | ||
"name": "test-transaction", | ||
"description": "a transaction", | ||
"steps": [] |
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.
it would be better to have a test here
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.
by test I mean step
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.
Done
@@ -34,6 +34,139 @@ paths: | |||
$ref: "./definition.yaml#/components/schemas/ExecuteDefinitionResponse" | |||
422: | |||
description: "trying to create a test with an already existing ID" | |||
/transactions: | |||
get: |
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.
Based on the UI design, we are going to need one single endpoint that returns tests
and transactions
(should support search, pagination, etc.). We could keep the get /transactions
endpoint and implement the unified one in a new PR.
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.
Yeah I remember that the idea was to have a single hub for both tests and transactions
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.
Hey @mathnogueira great job man!, I left some non-blocking comments!
@@ -34,6 +34,139 @@ paths: | |||
$ref: "./definition.yaml#/components/schemas/ExecuteDefinitionResponse" | |||
422: | |||
description: "trying to create a test with an already existing ID" | |||
/transactions: | |||
get: |
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.
Yeah I remember that the idea was to have a single hub for both tests and transactions
|
||
func (m Model) Transaction(ctx context.Context, in openapi.Transaction) (model.Transaction, error) { | ||
tests := make([]model.Test, len(in.Steps)) | ||
for i, testID := range in.Steps { |
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.
isn't it weird to have db queries a the mappers level? I think this should only set the default values (hydratation) to the object from the request and then the following logic of the controller can do the rest.
Maybe this is something we can address later on 😄
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.
I'll try to solve this in another PR
"transaction_steps", | ||
"transactions", | ||
"test_runs", | ||
"tests", |
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.
I forgot to add the environments table here, is it necessary?
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.
yes, it is. I'll add it
This PR...
Changes
Fixes
Checklist