Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OLEG
moscowhack
backend
Commits
a039c3f6
Commit
a039c3f6
authored
Jun 12, 2022
by
DmitSPopov
Browse files
Revert "added communitites"
This reverts commit
dc8c6bbb
parent
3e42e8e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
api/api_community.py
deleted
100644 → 0
View file @
3e42e8e5
from
web_setting
import
flask_app
,
ma
,
db
from
models.all_models
import
Community
#from api.api_tags import TagsSchema
from
api.api_employer
import
EmployerSchema
from
api.api_categories
import
CategoriesSchema
from
api.api_customers
import
CustomersSchema
from
api.api_tags
import
TagsGlobalSchema
class
CommunitySchema
(
ma
.
SQLAlchemyAutoSchema
):
class
Meta
:
model
=
Community
load_instance
=
True
include_relationships
=
True
exclude
=
[
'community_cus'
,
'tags_community_community'
]
# connect_customer = ma.Nested(CustomersSchema(exclude=('connect_com', 'customer_approve', 'id', )))
def
_base_query
():
return
db
.
session
.
query
(
Community
)
def
all_communities
():
data_query
=
_base_query
()
api_all_community
=
CommunitySchema
(
many
=
True
)
return
api_all_community
.
dump
(
data_query
)
def
filter_communities
(
community_id
=
None
):
data_query
=
_base_query
()
if
community_id
is
not
None
:
data_query
=
data_query
.
filter
(
Community
.
id
==
community_id
)
api_all_adv
=
CommunitySchema
(
many
=
True
)
return
api_all_adv
.
dump
(
data_query
)
buisness_logic/advertisement_actions.py
deleted
100644 → 0
View file @
3e42e8e5
from
flask
import
jsonify
from
backend.models.all_models
import
Advertisement
from
web_setting
import
flask_app
,
db
def
create_advertisement
(
adv_info
):
new_advertisement
=
Advertisement
(
new_adv_name
=
adv_info
.
adv_name
,
new_time_event
=
adv_info
.
time_event
,
new_type_event
=
adv_info
.
type_event
,
new_employer_id
=
adv_info
.
employer_id
,
new_coordinates_id
=
adv_info
.
coordinates_id
,
new_categories_id
=
adv_info
.
categories_id
,
new_wait_size_users
=
adv_info
.
wait_size_users
)
db
.
session
.
add
(
new_advertisement
)
db
.
session
.
commit
()
return
jsonify
(
'advert add success'
)
routers/community_routers.py
deleted
100644 → 0
View file @
3e42e8e5
from
api.api_community
import
filter_communities
from
buisness_logic.insert_models
import
add_new_repost
from
web_setting
import
flask_app
,
cross_origin
from
api.api_community
import
all_communities
from
pydantic
import
BaseModel
,
constr
from
typing
import
Optional
from
flask
import
jsonify
,
request
@
flask_app
.
route
(
'/api/communities'
,
methods
=
[
"GET"
])
def
eferqwgqer
():
result
=
all_communities
()
return
jsonify
(
result
)
@
flask_app
.
route
(
'/api/tzt'
,
methods
=
[
"GET"
])
def
sg
():
result
=
filter_communities
(
2
)
return
jsonify
(
result
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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