Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into change_password
Browse files Browse the repository at this point in the history
  • Loading branch information
brulitsan authored Mar 25, 2024
2 parents c8e2686 + 64518b2 commit c13edc9
Show file tree
Hide file tree
Showing 25 changed files with 226 additions and 141 deletions.
31 changes: 30 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Local Autotests
messenger_base_url=http://localhost:3000/messenger
notifications_base_url=http://localhost:3000/notifications
projects_base_url=http://localhost:3000/projects
Expand Down Expand Up @@ -37,3 +36,33 @@ qbTWAJTZFMYxUp7Q0F4//n+nmfDYVCEpql8HQYfjAoGBALI22w7ElulyaCK3vVb6
ixflfxwDP/6ekoJI2unCioiimu3ThnVzGNIFbKsdfAEedEocZlYkssDyQP6TgBqC
lUvD9FM5xR/Ec6L7MB+kJ1Op
-----END PRIVATE KEY-----"
jwt_access_token_public_key=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDf6p+1rxqSbg7TYcEo4Ov7OVlWzYm1Oj27uYkPXe7A8MujnlCGlPyXuCWyk4dFSTrdRQxINqo1di3lKHGbDTD4WzNk2Gq5BGYinU9LAFcZaWxuK5E9DlG96Yjyj1LnQuGfA+jEEt6/PDG8sfcKV2q6V/yfmrXTNyi5PDpxm1NjFsm3U0jNHxgIK9gCLlP02l/8DtCtwlj5BSOthRWMNzVNf6yvgtFiD1Fz0W+FR75M+1/eMnjujR8tLBcfmge8/wSifuJ8bjlXXplEaWMRdbzMN1l3pLrGWyMmo1+3U0aIuSRi0wofUlvvF/QgKRgcYN8rUqouvOSoqY4X+eHmGm/t
jwt_refresh_token_private_key="-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDscAs4CWwHC7Pe
yaPncMd16nacqene27pkGp8rKeSOzYKzGtjW+kiygvEZdVCeU+FfgXeu5pIEy65S
E76wWyAlxc2G60P6okXvj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rnA2
aOUxO+mysRtr+BnNfJHNej7ch9lG4hZyAMUW9G58gr6kLgQHdqcsUb+tAoGAXIBq
c6JHTu3DdUTkALcQopdWTDhmRKh7h/8je+ZcE1kGy0o1s5+wOuJy99NjPg2377Z0
E1nj0OTvMyq0hUPJZUCFsGuiHTD3RMenn4Z0ilxl7czf19CO/wa+njRatTqScfNh
qS1oRFNDIlxyQOKsNntrAYaW5BBRtJduB6XfV1MCgYEAo65fpLFwD2/Forszb9ZJ
cfnj/pOB5jPGkCqpmcntxhBzNwDx9gqmkGgiCFwbOilvM550AKET4hNZ7vUM0fCy
fuSFCsRSMvL+rgGR0ZMwobCN9YvYFYLqyTX7aJZODXPjmVQzv8HhDZ8tpxLdl8hO
IvB0E1DEEY2Dtyjs7laBP7A=
-----END PRIVATE KEY-----"
jwt_refresh_token_public_key=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDscAs4CWwHC7PeyaPncMd16nacqene27pkGp8rKeSOzYKzGtjW+kiygvEZdVCeU+FfgXeu5pIEy65SE76wWyAlxc2G60P6okXvjYJM8R3gk4zPTICBWkeVRmaqHD8asxv1wXAlgTfLg3hUWwWTeAXCvuULcCFmvRq0WKErbES9P2xuoV8CW4+zn7qF9KXWPTUuGdzX155MO8Y1WroH8QLEGYw/i3UYDNjigOkUAhoju3Tqn9NCRY25gntaxs1MmIab1Ourjnz8PZ8Hq6FqUf1GWhr5cviy4SeFER6/l+gXQRuqIJOsBIc4J8Yy6VeRDN1qcs+JmM0C2ElyCKCsQEnz
8 changes: 4 additions & 4 deletions autotests/clients/rest/projects/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def get_health(self) -> HealthResponse:

async def get_projects(
self,
text: str | Type[Empty] = Empty,
query: str | Type[Empty] = Empty,
owner_id: uuid.UUID | Type[Empty] = Empty,
user_id: uuid.UUID | Type[Empty] = Empty,
startline_ge: datetime | Type[Empty] = Empty,
Expand All @@ -53,7 +53,7 @@ async def get_projects(
) -> ProjectListResponse:
path = "/api/rest/projects/"
params = {
"query_text": text,
"query": query,
"owner_id": owner_id,
"user_id": user_id,
"startline_ge": startline_ge,
Expand Down Expand Up @@ -141,7 +141,7 @@ async def get_positions(
specialization_ids: list[uuid.UUID] | Type[Empty] = Empty,
skill_ids: list[uuid.UUID] | Type[Empty] = Empty,
joined_user_id: uuid.UUID | Type[Empty] = Empty,
project_query_text: str | Type[Empty] = Empty,
query: str | Type[Empty] = Empty,
project_startline_ge: datetime | Type[Empty] = Empty,
project_startline_le: datetime | Type[Empty] = Empty,
project_deadline_ge: datetime | Type[Empty] = Empty,
Expand All @@ -156,7 +156,7 @@ async def get_positions(
"specialization_ids": specialization_ids,
"skill_ids": skill_ids,
"joined_user_id": joined_user_id,
"project_query_text": project_query_text,
"query": query,
"project_startline_ge": project_startline_ge,
"project_startline_le": project_startline_le,
"project_deadline_ge": project_deadline_ge,
Expand Down
12 changes: 6 additions & 6 deletions autotests/clients/rest/storage/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ async def get_health(self) -> HealthResponse:

async def get_specialization_groups(
self,
query_text: str | Type[Empty] = Empty,
query: str | Type[Empty] = Empty,
group_ids: list[uuid.UUID] | Type[Empty] = Empty,
exclude_group_ids: list[uuid.UUID] | Type[Empty] = Empty,
) -> SpecializationGroupListResponse:
path = "/api/rest/spec-groups/"
params = {"query_text": query_text, "id": group_ids, "exclude_id": exclude_group_ids}
params = {"query": query, "id": group_ids, "exclude_id": exclude_group_ids}
params = {key: value for key, value in params.items() if value is not Empty}

return await self.rest_get(
Expand All @@ -34,14 +34,14 @@ async def get_specialization_groups(

async def get_specializations(
self,
query_text: str | type[Empty] = Empty,
query: str | type[Empty] = Empty,
group_id: uuid.UUID | Type[Empty] = Empty,
specialization_ids: list[uuid.UUID] | Type[Empty] = Empty,
exclude_specialization_ids: list[uuid.UUID] | Type[Empty] = Empty,
) -> SpecializationListResponse:
path = "/api/rest/specializations/"
params = {
"query_text": query_text,
"query": query,
"group_id": group_id,
"id": specialization_ids,
"exclude_id": exclude_specialization_ids,
Expand All @@ -54,12 +54,12 @@ async def get_specializations(

async def get_skills(
self,
query_text: str | Type[Empty] = Empty,
query: str | Type[Empty] = Empty,
skill_ids: list[uuid.UUID] | Type[Empty] = Empty,
exclude_skill_ids: list[uuid.UUID] | Type[Empty] = Empty,
) -> SkillListResponse:
path = "/api/rest/skills/"
params = {"query_text": query_text, "id": skill_ids, "exclude_id": exclude_skill_ids}
params = {"query": query, "id": skill_ids, "exclude_id": exclude_skill_ids}
params = {key: value for key, value in params.items() if value is not Empty}

return await self.rest_get(path=path, response_model=SkillListResponse, params=params)
6 changes: 3 additions & 3 deletions autotests/rest/projects/test_positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pytest.lazy_fixture("random_projects_rest_client"),
))
@pytest.mark.parametrize(
("project_id", "specialization_ids", "skill_ids", "joined_user_id", "project_query_text",
("project_id", "specialization_ids", "skill_ids", "joined_user_id", "query",
"project_startline_ge", "project_startline_le", "project_deadline_ge", "project_deadline_le",
"project_statuses", "page", "per_page"),
(
Expand Down Expand Up @@ -48,7 +48,7 @@ async def test_get_positions(
specialization_ids: list[uuid.UUID] | Type[Empty],
skill_ids: list[uuid.UUID] | Type[Empty],
joined_user_id: uuid.UUID | Type[Empty],
project_query_text: str | Type[Empty],
query: str | Type[Empty],
project_startline_ge: datetime | Type[Empty],
project_startline_le: datetime | Type[Empty],
project_deadline_ge: datetime | Type[Empty],
Expand All @@ -62,7 +62,7 @@ async def test_get_positions(
specialization_ids=specialization_ids,
skill_ids=skill_ids,
joined_user_id=joined_user_id,
project_query_text=project_query_text,
query=query,
project_startline_ge=project_startline_ge,
project_startline_le=project_startline_le,
project_deadline_ge=project_deadline_ge,
Expand Down
6 changes: 3 additions & 3 deletions autotests/rest/projects/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
))
@pytest.mark.parametrize(
(
"text", "owner_id", "user_id", "startline_ge", "startline_le", "deadline_ge", "deadline_le",
"query", "owner_id", "user_id", "startline_ge", "startline_le", "deadline_ge", "deadline_le",
"statuses", "position_skill_ids", "position_specialization_ids",
"participant_user_ids", "page", "per_page",
),
Expand All @@ -48,7 +48,7 @@
@pytest.mark.asyncio
async def test_get_projects(
client: ProjectsRestClient,
text: str | Type[Empty],
query: str | Type[Empty],
owner_id: uuid.UUID | Type[Empty],
user_id: uuid.UUID | Type[Empty],
startline_ge: datetime | Type[Empty],
Expand All @@ -63,7 +63,7 @@ async def test_get_projects(
per_page: int,
):
projects = await client.get_projects(
text=text,
query=query,
owner_id=owner_id,
user_id=user_id,
startline_ge=startline_ge,
Expand Down
6 changes: 3 additions & 3 deletions autotests/rest/storage/test_skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
from autotests.utils import Empty


@pytest.mark.parametrize(("query_text", "skill_ids", "exclude_skill_ids"), (
@pytest.mark.parametrize(("query", "skill_ids", "exclude_skill_ids"), (
(Empty, Empty, Empty),
("Python", Empty, [uuid.uuid4(), uuid.uuid4()]),
(Empty, [uuid.uuid4(), uuid.uuid4()], Empty),
))
@pytest.mark.asyncio
async def test_get_skills(
storage_rest_client: StorageRestClient,
query_text: str | Type[Empty],
query: str | Type[Empty],
skill_ids: list[uuid.UUID] | Type[Empty],
exclude_skill_ids: list[uuid.UUID] | Type[Empty],
):
await storage_rest_client.get_skills(
query_text=query_text,
query=query,
skill_ids=skill_ids,
exclude_skill_ids=exclude_skill_ids,
)
6 changes: 3 additions & 3 deletions autotests/rest/storage/test_specialization_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
from autotests.utils import Empty


@pytest.mark.parametrize(("query_text", "group_ids", "exclude_group_ids"), (
@pytest.mark.parametrize(("query", "group_ids", "exclude_group_ids"), (
(Empty, Empty, Empty),
("Developer", [uuid.uuid4()], [uuid.uuid4()]),
))
@pytest.mark.asyncio
async def test_get_specialization_groups(
storage_rest_client: StorageRestClient,
query_text: str | Type[Empty],
query: str | Type[Empty],
group_ids: list[uuid.UUID] | Type[Empty],
exclude_group_ids: list[uuid.UUID] | Type[Empty],
):
await storage_rest_client.get_specialization_groups(
query_text=query_text,
query=query,
group_ids=group_ids,
exclude_group_ids=exclude_group_ids,
)
6 changes: 3 additions & 3 deletions autotests/rest/storage/test_specializations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@pytest.mark.parametrize(
("query_text", "group_id", "specialization_ids", "exclude_specialization_ids"),
("query", "group_id", "specialization_ids", "exclude_specialization_ids"),
(
(Empty, Empty, Empty, Empty),
("Developer", uuid.uuid4(), [uuid.uuid4()], [uuid.uuid4()]),
Expand All @@ -17,13 +17,13 @@
@pytest.mark.asyncio
async def test_specializations(
storage_rest_client: StorageRestClient,
query_text: str | Type[Empty],
query: str | Type[Empty],
group_id: uuid.UUID | Type[Empty],
specialization_ids: list[uuid.UUID] | Type[Empty],
exclude_specialization_ids: list[uuid.UUID] | Type[Empty],
):
await storage_rest_client.get_specializations(
query_text=query_text,
query=query,
group_id=group_id,
specialization_ids=specialization_ids,
exclude_specialization_ids=exclude_specialization_ids,
Expand Down
44 changes: 44 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: "3"
services:
database:
image: postgres:16.0-bookworm
user: 0:0
environment:
POSTGRES_USER: sapphire
POSTGRES_DB: sapphire
POSTGRES_PASSWORD: P@ssw0rd
volumes:
- ./database_data:/var/lib/postgresql/data
ports:
- 5432:5432

redis:
image: redis:7.2.1-bookworm
volumes:
- ./redis_data:/data

zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
user: 0:0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
volumes:
- ./broker_data/zookeeper/data:/var/lib/zookeeper/data
- ./broker_data/zookeeper/log:/var/lib/zookeeper/log
ports:
- 2181:2181

kafka:
image: confluentinc/cp-kafka:7.5.0
user: 0:0
environment:
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9091
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
volumes:
- ./broker_data/kafka/data:/var/lib/kafka/data
ports:
- 9091:9091
2 changes: 1 addition & 1 deletion sapphire/projects/api/rest/positions/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def get_positions(
"specialization_ids": filters.specialization_ids,
"skill_ids": filters.skill_ids,
"joined_user_id": filters.joined_user_id,
"project_query_text": filters.project_query_text,
"query": filters.query,
"project_startline_ge": filters.project_startline_ge,
"project_startline_le": filters.project_startline_le,
"project_deadline_ge": filters.project_deadline_ge,
Expand Down
2 changes: 1 addition & 1 deletion sapphire/projects/api/rest/positions/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PositionListFiltersRequest(BaseModel):
specialization_ids: list[uuid.UUID] | Type[Empty] = Field(fastapi.Query(Empty))
skill_ids: list[uuid.UUID] | Type[Empty] = Field(fastapi.Query(Empty))
joined_user_id: uuid.UUID | Type[Empty] = Empty
project_query_text: str | Type[Empty] = Empty
query: str | Type[Empty] = Empty
project_startline_ge: AwareDatetime | Type[Empty] = Empty
project_startline_le: AwareDatetime | Type[Empty] = Empty
project_deadline_ge: AwareDatetime | Type[Empty] = Empty
Expand Down
2 changes: 1 addition & 1 deletion sapphire/projects/api/rest/projects/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def get_projects(
async with database_service.transaction() as session:
params = {
"session": session,
"query_text": filters.query_text,
"query": filters.query,
"owner_id": filters.owner_id,
"user_id": filters.user_id,
"startline_le": filters.startline_le,
Expand Down
2 changes: 1 addition & 1 deletion sapphire/projects/api/rest/projects/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ProjectListResponse(PaginatedResponse):


class ProjectListFiltersRequest(BaseModel):
query_text: str | Type[Empty] = Empty
query: str | Type[Empty] = Empty
owner_id: uuid.UUID | Type[Empty] = Empty
user_id: uuid.UUID | Type[Empty] = Empty
startline_ge: AwareDatetime | Type[Empty] = Empty
Expand Down
Loading

0 comments on commit c13edc9

Please sign in to comment.