Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plataforma de Marketing e Sales Analytics
revforce-api
Commits
9fb7d1c5
Commit
9fb7d1c5
authored
6 days ago
by
OliviaLivak
Browse files
Options
Download
Email Patches
Plain Diff
Criação dos métodos update e delete do account
parent
be899629
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/accounts.py
+16
-2
app/services/accounts.py
with
16 additions
and
2 deletions
+16
-2
app/services/accounts.py
View file @
9fb7d1c5
...
...
@@ -4,6 +4,8 @@ from sqlalchemy.dialects.postgresql import insert
from
app.config.database
import
get_db
from
sqlalchemy
import
select
from
starlette
import
status
from
sqlalchemy
import
update
from
sqlalchemy
import
delete
from
uuid
import
uuid4
from
app.schemas.accounts
import
AccountRequest
...
...
@@ -37,10 +39,22 @@ class AccountsService:
return
result
.
scalar_one
()
async
def
update_account
(
self
,
account_id
:
str
,
account
:
AccountRequest
):
raise
NotImplementedError
()
result
=
await
self
.
__session
.
execute
(
update
(
Account
).
where
(
Account
.
id
==
account_id
)
.
values
(
name
=
account
.
name
)
.
returning
(
Account
)
)
await
self
.
__session
.
commit
()
return
result
.
scalar_one
()
async
def
delete_account
(
self
,
account_id
:
str
):
raise
NotImplementedError
()
result
=
await
self
.
__session
.
execute
(
delete
(
Account
).
where
(
Account
.
id
==
account_id
)
)
await
self
.
__session
.
commit
()
@
classmethod
async
def
get_service
(
cls
,
db
:
AsyncSession
=
Depends
(
get_db
)):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment