-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add service orders patch #104
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3ff9ccc
Add service orders patch
729e031
Merge branch 'develop' into feature/91_new_patch_service_order
Adrilene d98a40e
[@adrilene/@denisousa] Issue #91 - Iniciando validações de PATCH.
Adrilene b88e7a9
[@adrilene/@denisousa/@sarahraqueld] issue #91 testes e update da or…
denisousa 662a81c
[@adrilene/@denisousa] # issue 91 correção nos testes quebrados
denisousa 434c7ea
[@adrilene/@denisousa] Issue #91 - Correções do PR
Adrilene File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class ServiceOrderRequest: | ||
def __init__(self, data): | ||
self.tipo = data["tipo"] | ||
self.data = data | ||
|
||
def get(self): | ||
return self.data | ||
|
||
def valid(self): | ||
return True | ||
|
||
def errors(self): | ||
return [{}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class ServiceOrdersRequest(): | ||
def __init__(self, data): | ||
self.data = data | ||
|
||
def errors(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def pop_id(data): | ||
id = data['_id'] | ||
try: | ||
del data['_id'] | ||
except Exception: | ||
return Exception | ||
|
||
return id | ||
|
||
|
||
def define_updated_fields(current_key, current_value): | ||
""" | ||
current_key: String | ||
current_value: Any Primitive type | ||
""" | ||
query = {} | ||
if type(current_value) == dict: | ||
for k, v in current_value.items(): | ||
query.update(define_updated_fields( | ||
current_key + "__{}".format(k), v)) | ||
|
||
else: | ||
query[current_key] = current_value | ||
|
||
return query | ||
|
||
|
||
def update_only_fields(_id, data, model): | ||
""" | ||
_id: ObjectId | ||
data: Dict | ||
model: Mongoengine.Document | ||
""" | ||
query = {} | ||
root_key = "set" | ||
root_value = data | ||
query.update(define_updated_fields(root_key, root_value)) | ||
|
||
model.objects(id=_id).update(**query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def valid_service_order(): | ||
return { | ||
"content": { "id": "1", "tipo": "Tipo 1"} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Essa classe está sendo utilizada na aplicação? Se sim, o método
errors
é realmente necessário? Aparentemente ele só está chamando opass
.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.
Toda a pasta dtos foi feita pela @sarahraqueld , mas não sei onde nem mesmo se é usada. Então queria deixar nas mãos dela a deleção ou não.