From 270bab11cfb1019d0d0ce2b03dfacca66968250c Mon Sep 17 00:00:00 2001 From: DROPDATABASE Date: Mon, 21 Apr 2025 12:07:33 +0300 Subject: [PATCH 1/6] Modify GET comment for alert bot --- rating_api/routes/comment.py | 87 ++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/rating_api/routes/comment.py b/rating_api/routes/comment.py index 96a9de8..313957c 100644 --- a/rating_api/routes/comment.py +++ b/rating_api/routes/comment.py @@ -166,7 +166,6 @@ async def get_comment(uuid: UUID) -> CommentGet: raise ObjectNotFound(Comment, uuid) return CommentGet.model_validate(comment) - @comment.get("", response_model=Union[CommentGetAll, CommentGetAllWithAllInfo, CommentGetAllWithStatus]) async def get_comments( limit: int = 10, @@ -175,6 +174,7 @@ async def get_comments( user_id: int | None = None, order_by: list[Literal["create_ts"]] = Query(default=[]), unreviewed: bool = False, + review_mode: Literal["all", "pending"] = "all", # вот ключ user=Depends(UnionAuth(scopes=["rating.comment.review"], auto_error=False, allow_none=True)), ) -> CommentGetAll: """ @@ -194,44 +194,63 @@ async def get_comments( `unreviewed` - вернет все непроверенные комментарии, если True. По дефолту False. """ - comments = Comment.query(session=db.session).all() - if not comments: - raise ObjectNotFound(Comment, 'all') - if "rating.comment.review" in [scope['name'] for scope in user.get('session_scopes')]: - result = CommentGetAllWithAllInfo(limit=limit, offset=offset, total=len(comments)) - comment_validator = CommentGetWithAllInfo - elif user.get('id') == user_id: - result = CommentGetAllWithStatus(limit=limit, offset=offset, total=len(comments)) - comment_validator = CommentGetWithStatus - else: - result = CommentGetAll(limit=limit, offset=offset, total=len(comments)) - comment_validator = CommentGet - result.comments = comments - if user_id is not None: - result.comments = [comment for comment in result.comments if comment.user_id == user_id] - - if lecturer_id is not None: - result.comments = [comment for comment in result.comments if comment.lecturer_id == lecturer_id] - - if unreviewed: - if not user: - raise ForbiddenAction(Comment) + + if review_mode == "pending": # Для бота либо без проблем получить все Pending + query = Comment.query(session=db.session) + # пусто или нет + query = query.filter( + Comment.review_status == ReviewStatus.PENDING,) + + comments = query.all() + if not comments: + return CommentGetAll(polls=[], limit=limit, offset=offset, total=0) + + paginated = comments[offset:offset+limit] + paginated.sort(key = lambda c: c.create_ts, reverse=True) + + return CommentGetAll( + comments=paginated,limit=limit,offset=offset, total=len(comments) + ) + + else: + comments = Comment.query(session=db.session).all() + if not comments: + raise ObjectNotFound(Comment, 'all') + if "rating.comment.review" in [scope['name'] for scope in user.get('session_scopes')]: - result.comments = [comment for comment in result.comments if comment.review_status is ReviewStatus.PENDING] + result = CommentGetAllWithAllInfo(limit=limit, offset=offset, total=len(comments)) + comment_validator = CommentGetWithAllInfo + elif user.get('id') == user_id: + result = CommentGetAllWithStatus(limit=limit, offset=offset, total=len(comments)) + comment_validator = CommentGetWithStatus else: - raise ForbiddenAction(Comment) - else: - result.comments = [comment for comment in result.comments if comment.review_status is ReviewStatus.APPROVED] + result = CommentGetAll(limit=limit, offset=offset, total=len(comments)) + comment_validator = CommentGet + result.comments = comments + if user_id is not None: + result.comments = [comment for comment in result.comments if comment.user_id == user_id] + + if lecturer_id is not None: + result.comments = [comment for comment in result.comments if comment.lecturer_id == lecturer_id] + + if unreviewed: + if not user: + raise ForbiddenAction(Comment) + if "rating.comment.review" in [scope['name'] for scope in user.get('session_scopes')]: + result.comments = [comment for comment in result.comments if comment.review_status is ReviewStatus.PENDING] + else: + raise ForbiddenAction(Comment) + else: + result.comments = [comment for comment in result.comments if comment.review_status is ReviewStatus.APPROVED] - result.comments = result.comments[offset : limit + offset] + result.comments = result.comments[offset : limit + offset] - if "create_ts" in order_by: + if "create_ts" in order_by: + result.comments.sort(key=lambda comment: comment.create_ts, reverse=True) + result.total = len(result.comments) + result.comments = [comment_validator.model_validate(comment) for comment in result.comments] result.comments.sort(key=lambda comment: comment.create_ts, reverse=True) - result.total = len(result.comments) - result.comments = [comment_validator.model_validate(comment) for comment in result.comments] - result.comments.sort(key=lambda comment: comment.create_ts, reverse=True) - return result - + return result @comment.patch("/{uuid}/review", response_model=CommentGetWithAllInfo) async def review_comment( From 3b28993683bd57672291f1de2ab7fdbcc74c2050 Mon Sep 17 00:00:00 2001 From: DROPDATABASE Date: Thu, 24 Apr 2025 22:54:55 +0300 Subject: [PATCH 2/6] fixup --- .DS_Store | Bin 0 -> 8196 bytes .vscode/settings.json | 25 +++++++++++++++++++++++++ FF-Team.session.sql | 9 +++++++++ Makefile | 10 +++++----- rating_api/.DS_Store | Bin 0 -> 6148 bytes rating_api/settings.py | 2 +- rating_api/utils/.DS_Store | Bin 0 -> 6148 bytes 7 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .DS_Store create mode 100644 .vscode/settings.json create mode 100644 FF-Team.session.sql create mode 100644 rating_api/.DS_Store create mode 100644 rating_api/utils/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7982a048d98f77f81805d02fa0093824eb14c4dd GIT binary patch literal 8196 zcmeHMO>fgc5S{G@aT-wtC{iy-mbjLX6x3GYlBO+ECCZ_x-~cGtNg7ODZyGxds4B`C z{sVu3E5C&Q!U^8&ZbRZEW^FH61*`&A0jq#jz$$PZ6u_R%#hJ42>$|qK3RngHO9lA% z!9`^(8|-UTKOJaP3ILqLWmV8e9-ug`!Lq@=Mn#2BojnLc6(+?HnvVM}n*+-R`x-T! zgr<`)k%h@ngo+NHtISE1HQLrHU=?k%Db|-1D?`s{m$qn!o>P@}Qr16H)_Fvb)WX5vGFnul2BMu#i>B21I;766 zF@75=NqCv^yu?~v?jccHCDS}8orXO)v}aVBI68tA8n$1+hy-}o4p@m9k$8em!<{fD{fWaaI#LemR~+QTP>}vxTV#N^A-1OeZ9EiK7O=zex7yi-hcRHzjhQJ zNAfeYMiFNFqMQ1B(DGPJ)Z?_;i9#8*n2egGeazrZti3&80V+3ABLq()iY-CqCY?|h zBg(yF)CeOKgMBfl6Z$|&$`4k=h@bo=ekSmFMTk#Bqdkw9yw(wUG?JPZe=PL|ZukGe z)UX|^z?CR4tGzDgfIHK_|6fUL>(nY>6}TP>h`H_Rb_LIJ@yAK}u{hUuQQx9+VY|LY nMM0y|aiB`afrEb-qVK|#Ic0-=jktnhKLjWlY-1JprwaTA6ed2# literal 0 HcmV?d00001 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cc29608 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,25 @@ +{ + "makefile.configureOnOpen": false, + "sqltools.connections": [ + { + "previewLimit": 50, + "server": "db.profcomff.com", + "port": 25432, + "driver": "PostgreSQL", + "name": "FF-Team DB", + "database": "test", + "group": "db.profcomff.com", + "username": "ukhanovak", + "password": "BXJg4hk_l" + }, + { + "previewLimit": 50, + "server": "localhost", + "port": 54322, + "driver": "PostgreSQL", + "name": "FF-Team", + "database": "postgres", + "username": "postgres" + } + ] +} \ No newline at end of file diff --git a/FF-Team.session.sql b/FF-Team.session.sql new file mode 100644 index 0000000..53dd0db --- /dev/null +++ b/FF-Team.session.sql @@ -0,0 +1,9 @@ +SELECT * FROM lecturer +INSERT INTO lecturer VALUES(0, 'txt', 'txt', 'txt', 'txt', 0, FALSE) + +SELECT 100 + +SELECT * FROM comment + +INSERT INTO comment VALUES('2025-03-17 12:37:35.963176', '2025-03-17 12:37:35.963176', 'string', 'string', 0, 0, 0, 0, 'PENDING','3e404cad-476b-4a62-8c9e-33382ea12d89', null, FALSE) + diff --git a/Makefile b/Makefile index 8a826f9..eaf9772 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ run: - source ./venv/bin/activate && uvicorn --reload --log-config logging_dev.conf rating_api.routes.base:app + uvicorn --reload --log-config logging_dev.conf rating_api.routes.base:app configure: venv source ./venv/bin/activate && pip install -r requirements.dev.txt -r requirements.txt @@ -8,15 +8,15 @@ venv: python3.11 -m venv venv format: - autoflake -r --in-place --remove-all-unused-imports ./rating_api - isort ./rating_api - black ./rating_api + autoflake -r --in-place --remove-all-unused-imports . + isort . + black . autoflake -r --in-place --remove-all-unused-imports ./migrations isort ./migrations black ./migrations db: - docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-rating_api postgres:15 + docker run -d -p 54322:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-rating_api postgres:15 migrate: alembic upgrade head diff --git a/rating_api/.DS_Store b/rating_api/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4d63e043c50e096c7d4b2d387db5f39ad13acf4d GIT binary patch literal 6148 zcmeHKL2uJA6n@^iHKm%=14z3dMdDhGcAyPumr%xmD?xAoRFXE@BGR~OQp!|S${GFx ze}OB%g#W?`zGpiqP1_R^LddVOKgWJwp5Is5j)_PN=Hot5hlm^$#>OpFTa3rKY}lUZ zX#<6NM@%^l@jIdEhPUmo3RngHH3fL>w$+-ADW&TAy?K_%QJBaO9=ts~MmhPZ46Twi zp#ZG(_o}b6zHVhr>4rvNj_8^q=B~#QcWbO8czuL-gncDPJc)>z+GT3-#OE6GkS6dR zgPBlPi}GW`cLv`%B1CmxmHn4W_D#gsvu6crZzj&V>fMHSg!l5?Q@YwQch0)XI#6?o zx6GWg+~FB6vZ?vkzJ=2y&hlRGyV%=r92_>Crqg!b`qy&d=RrQt2Ept#KfRDL3Cng6 zzKo;Auygx~O!FX4qnRSa;|MNqUd8EHE(UU*jx)ve^?=iITEouqa(UW6>$?5ZN2{*8 zJU{Ps-G>j(R;!kC=idE`=fn5OB$b~qdziqPq3p0&tRbuBQT+F$SorJl32oqVD8;VfT@qSmilkha!+A3fbSXW?QKX&;1f4ckrzfQ7G zRspNPf2DwET>6&-q-4(4jpX>Oby41-u(4mEQBhEt<5)HLC_Y9}hB22LK+j;I5j`;b OA)sWil~v%cD)0;HqQxNq literal 0 HcmV?d00001 diff --git a/rating_api/settings.py b/rating_api/settings.py index 27b3873..edde24c 100644 --- a/rating_api/settings.py +++ b/rating_api/settings.py @@ -15,7 +15,7 @@ class Settings(BaseSettings): """Application settings""" - DB_DSN: PostgresDsn = 'postgresql://postgres@localhost:5432/postgres' + DB_DSN: PostgresDsn = 'postgresql://postgres@localhost:54322/postgres' ROOT_PATH: str = '/' + os.getenv("APP_NAME", "") COMMENT_FREQUENCY_IN_MONTH: int = 10 COMMENT_LECTURER_FREQUENCE_IN_MONTH: int = 6 diff --git a/rating_api/utils/.DS_Store b/rating_api/utils/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1b0c479332d0dd703a04bff706fd20c9213c35ee GIT binary patch literal 6148 zcmeHK&8pKt6h3oXZE6vMsJINcaZ#_m{vDSrKBf3zjNmJTz(@beo!=)6uRD1_t z!JRK4_z1p>EB(&Q6mr`ul)DhQ%n4_{`8nTA@-aUdA`;z2d_?3DkppL}UO{q(aXb5t z9hjO1P^dl<%Bhd%kfuA)w!$i475Lv2;I-ROYc`>b%Io*!c`64{DkDVj_V5IL_*)rr z8`hLgXh0!+OhfKxi}iJjb&XPzG{VE7mQ^Q;<@4my1}VC^}c&^xqQ@adhO1t=`A~*R?~aLT0ZoO-Dz;Ku*d#?q0l!?DdR7PUXJ1d*}NPR(elv zd~WV^e7^Vn5X`bvW+S{KYv%6EqyR9_ z%*=Cm53ptxunJfO$_nuQ;K3PvgKLdy>p-He0Kh7$l_AeR3(WBh`Uck;(E<~i3e;3# zt{6hoQSX^J-{4xKrjsz24`D_Y=7u8F=;+^5;Us*GHnj>^1x_na(M6Zf|7U-{|DPt= zl2yPeaG?|s)n3r+;*-qTy7O^-)_U;wa5j!xYg7~@<~UXvK8kO_m7&e!4A3{Y)`%LI P{Si Date: Fri, 25 Apr 2025 09:51:10 +0300 Subject: [PATCH 3/6] Fixup --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 2 +- .vscode/settings.json | 25 ------------------------- FF-Team.session.sql | 9 --------- Makefile | 10 +++++----- rating_api/routes/comment.py | 27 +++++++++++++++------------ rating_api/settings.py | 6 ++---- 7 files changed, 23 insertions(+), 56 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .vscode/settings.json delete mode 100644 FF-Team.session.sql diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 7982a048d98f77f81805d02fa0093824eb14c4dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMO>fgc5S{G@aT-wtC{iy-mbjLX6x3GYlBO+ECCZ_x-~cGtNg7ODZyGxds4B`C z{sVu3E5C&Q!U^8&ZbRZEW^FH61*`&A0jq#jz$$PZ6u_R%#hJ42>$|qK3RngHO9lA% z!9`^(8|-UTKOJaP3ILqLWmV8e9-ug`!Lq@=Mn#2BojnLc6(+?HnvVM}n*+-R`x-T! zgr<`)k%h@ngo+NHtISE1HQLrHU=?k%Db|-1D?`s{m$qn!o>P@}Qr16H)_Fvb)WX5vGFnul2BMu#i>B21I;766 zF@75=NqCv^yu?~v?jccHCDS}8orXO)v}aVBI68tA8n$1+hy-}o4p@m9k$8em!<{fD{fWaaI#LemR~+QTP>}vxTV#N^A-1OeZ9EiK7O=zex7yi-hcRHzjhQJ zNAfeYMiFNFqMQ1B(DGPJ)Z?_;i9#8*n2egGeazrZti3&80V+3ABLq()iY-CqCY?|h zBg(yF)CeOKgMBfl6Z$|&$`4k=h@bo=ekSmFMTk#Bqdkw9yw(wUG?JPZe=PL|ZukGe z)UX|^z?CR4tGzDgfIHK_|6fUL>(nY>6}TP>h`H_Rb_LIJ@yAK}u{hUuQQx9+VY|LY nMM0y|aiB`afrEb-qVK|#Ic0-=jktnhKLjWlY-1JprwaTA6ed2# diff --git a/.gitignore b/.gitignore index b6e4761..7f30d9d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ __pycache__/ *.py[cod] *$py.class - +*.DS_Store # C extensions *.so diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cc29608..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "makefile.configureOnOpen": false, - "sqltools.connections": [ - { - "previewLimit": 50, - "server": "db.profcomff.com", - "port": 25432, - "driver": "PostgreSQL", - "name": "FF-Team DB", - "database": "test", - "group": "db.profcomff.com", - "username": "ukhanovak", - "password": "BXJg4hk_l" - }, - { - "previewLimit": 50, - "server": "localhost", - "port": 54322, - "driver": "PostgreSQL", - "name": "FF-Team", - "database": "postgres", - "username": "postgres" - } - ] -} \ No newline at end of file diff --git a/FF-Team.session.sql b/FF-Team.session.sql deleted file mode 100644 index 53dd0db..0000000 --- a/FF-Team.session.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT * FROM lecturer -INSERT INTO lecturer VALUES(0, 'txt', 'txt', 'txt', 'txt', 0, FALSE) - -SELECT 100 - -SELECT * FROM comment - -INSERT INTO comment VALUES('2025-03-17 12:37:35.963176', '2025-03-17 12:37:35.963176', 'string', 'string', 0, 0, 0, 0, 'PENDING','3e404cad-476b-4a62-8c9e-33382ea12d89', null, FALSE) - diff --git a/Makefile b/Makefile index eaf9772..8a826f9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ run: - uvicorn --reload --log-config logging_dev.conf rating_api.routes.base:app + source ./venv/bin/activate && uvicorn --reload --log-config logging_dev.conf rating_api.routes.base:app configure: venv source ./venv/bin/activate && pip install -r requirements.dev.txt -r requirements.txt @@ -8,15 +8,15 @@ venv: python3.11 -m venv venv format: - autoflake -r --in-place --remove-all-unused-imports . - isort . - black . + autoflake -r --in-place --remove-all-unused-imports ./rating_api + isort ./rating_api + black ./rating_api autoflake -r --in-place --remove-all-unused-imports ./migrations isort ./migrations black ./migrations db: - docker run -d -p 54322:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-rating_api postgres:15 + docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-rating_api postgres:15 migrate: alembic upgrade head diff --git a/rating_api/routes/comment.py b/rating_api/routes/comment.py index 313957c..74b2002 100644 --- a/rating_api/routes/comment.py +++ b/rating_api/routes/comment.py @@ -166,6 +166,7 @@ async def get_comment(uuid: UUID) -> CommentGet: raise ObjectNotFound(Comment, uuid) return CommentGet.model_validate(comment) + @comment.get("", response_model=Union[CommentGetAll, CommentGetAllWithAllInfo, CommentGetAllWithStatus]) async def get_comments( limit: int = 10, @@ -199,24 +200,23 @@ async def get_comments( query = Comment.query(session=db.session) # пусто или нет query = query.filter( - Comment.review_status == ReviewStatus.PENDING,) - + Comment.review_status == ReviewStatus.PENDING, + ) + comments = query.all() if not comments: return CommentGetAll(polls=[], limit=limit, offset=offset, total=0) - - paginated = comments[offset:offset+limit] - paginated.sort(key = lambda c: c.create_ts, reverse=True) - return CommentGetAll( - comments=paginated,limit=limit,offset=offset, total=len(comments) - ) - - else: + paginated = comments[offset : offset + limit] + paginated.sort(key=lambda c: c.create_ts, reverse=True) + + return CommentGetAll(comments=paginated, limit=limit, offset=offset, total=len(comments)) + + else: comments = Comment.query(session=db.session).all() if not comments: raise ObjectNotFound(Comment, 'all') - + if "rating.comment.review" in [scope['name'] for scope in user.get('session_scopes')]: result = CommentGetAllWithAllInfo(limit=limit, offset=offset, total=len(comments)) comment_validator = CommentGetWithAllInfo @@ -237,7 +237,9 @@ async def get_comments( if not user: raise ForbiddenAction(Comment) if "rating.comment.review" in [scope['name'] for scope in user.get('session_scopes')]: - result.comments = [comment for comment in result.comments if comment.review_status is ReviewStatus.PENDING] + result.comments = [ + comment for comment in result.comments if comment.review_status is ReviewStatus.PENDING + ] else: raise ForbiddenAction(Comment) else: @@ -252,6 +254,7 @@ async def get_comments( result.comments.sort(key=lambda comment: comment.create_ts, reverse=True) return result + @comment.patch("/{uuid}/review", response_model=CommentGetWithAllInfo) async def review_comment( uuid: UUID, diff --git a/rating_api/settings.py b/rating_api/settings.py index edde24c..a5baeca 100644 --- a/rating_api/settings.py +++ b/rating_api/settings.py @@ -15,7 +15,7 @@ class Settings(BaseSettings): """Application settings""" - DB_DSN: PostgresDsn = 'postgresql://postgres@localhost:54322/postgres' + DB_DSN: PostgresDsn = 'postgresql://postgres@localhost:5432/postgres' ROOT_PATH: str = '/' + os.getenv("APP_NAME", "") COMMENT_FREQUENCY_IN_MONTH: int = 10 COMMENT_LECTURER_FREQUENCE_IN_MONTH: int = 6 @@ -27,9 +27,7 @@ class Settings(BaseSettings): CORS_ALLOW_METHODS: list[str] = ['*'] CORS_ALLOW_HEADERS: list[str] = ['*'] MAX_COMMENT_LENGTH: int = 3000 - LOGGING_MARKETING_URL: str = LOGGING_MARKETING_URLS.get( - os.getenv("APP_ENV", "dev"), LOGGING_MARKETING_URLS["test"] - ) + LOGGING_MARKETING_URL: str = LOGGING_MARKETING_URLS.get(os.getenv("APP_ENV", "dev"), LOGGING_MARKETING_URLS["test"]) '''Temp settings''' From 086fa0d5d02a7e2b3b9719ac558c316368f1fd46 Mon Sep 17 00:00:00 2001 From: DROPDATABASE Date: Fri, 25 Apr 2025 09:53:02 +0300 Subject: [PATCH 4/6] Fixup --- rating_api/.DS_Store | Bin 6148 -> 0 bytes rating_api/utils/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 rating_api/.DS_Store delete mode 100644 rating_api/utils/.DS_Store diff --git a/rating_api/.DS_Store b/rating_api/.DS_Store deleted file mode 100644 index 4d63e043c50e096c7d4b2d387db5f39ad13acf4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKL2uJA6n@^iHKm%=14z3dMdDhGcAyPumr%xmD?xAoRFXE@BGR~OQp!|S${GFx ze}OB%g#W?`zGpiqP1_R^LddVOKgWJwp5Is5j)_PN=Hot5hlm^$#>OpFTa3rKY}lUZ zX#<6NM@%^l@jIdEhPUmo3RngHH3fL>w$+-ADW&TAy?K_%QJBaO9=ts~MmhPZ46Twi zp#ZG(_o}b6zHVhr>4rvNj_8^q=B~#QcWbO8czuL-gncDPJc)>z+GT3-#OE6GkS6dR zgPBlPi}GW`cLv`%B1CmxmHn4W_D#gsvu6crZzj&V>fMHSg!l5?Q@YwQch0)XI#6?o zx6GWg+~FB6vZ?vkzJ=2y&hlRGyV%=r92_>Crqg!b`qy&d=RrQt2Ept#KfRDL3Cng6 zzKo;Auygx~O!FX4qnRSa;|MNqUd8EHE(UU*jx)ve^?=iITEouqa(UW6>$?5ZN2{*8 zJU{Ps-G>j(R;!kC=idE`=fn5OB$b~qdziqPq3p0&tRbuBQT+F$SorJl32oqVD8;VfT@qSmilkha!+A3fbSXW?QKX&;1f4ckrzfQ7G zRspNPf2DwET>6&-q-4(4jpX>Oby41-u(4mEQBhEt<5)HLC_Y9}hB22LK+j;I5j`;b OA)sWil~v%cD)0;HqQxNq diff --git a/rating_api/utils/.DS_Store b/rating_api/utils/.DS_Store deleted file mode 100644 index 1b0c479332d0dd703a04bff706fd20c9213c35ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&8pKt6h3oXZE6vMsJINcaZ#_m{vDSrKBf3zjNmJTz(@beo!=)6uRD1_t z!JRK4_z1p>EB(&Q6mr`ul)DhQ%n4_{`8nTA@-aUdA`;z2d_?3DkppL}UO{q(aXb5t z9hjO1P^dl<%Bhd%kfuA)w!$i475Lv2;I-ROYc`>b%Io*!c`64{DkDVj_V5IL_*)rr z8`hLgXh0!+OhfKxi}iJjb&XPzG{VE7mQ^Q;<@4my1}VC^}c&^xqQ@adhO1t=`A~*R?~aLT0ZoO-Dz;Ku*d#?q0l!?DdR7PUXJ1d*}NPR(elv zd~WV^e7^Vn5X`bvW+S{KYv%6EqyR9_ z%*=Cm53ptxunJfO$_nuQ;K3PvgKLdy>p-He0Kh7$l_AeR3(WBh`Uck;(E<~i3e;3# zt{6hoQSX^J-{4xKrjsz24`D_Y=7u8F=;+^5;Us*GHnj>^1x_na(M6Zf|7U-{|DPt= zl2yPeaG?|s)n3r+;*-qTy7O^-)_U;wa5j!xYg7~@<~UXvK8kO_m7&e!4A3{Y)`%LI P{Si Date: Fri, 25 Apr 2025 09:59:56 +0300 Subject: [PATCH 5/6] linting --- rating_api/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rating_api/settings.py b/rating_api/settings.py index 4e49b06..63069d4 100644 --- a/rating_api/settings.py +++ b/rating_api/settings.py @@ -22,7 +22,6 @@ class Settings(BaseSettings): CORS_ALLOW_HEADERS: list[str] = ['*'] MAX_COMMENT_LENGTH: int = 3000 - '''Temp settings''' API_URL: str = "https://api.test.profcomff.com/" From 4c24bb38d0d3623fea8244ff2853eab0f996b1b5 Mon Sep 17 00:00:00 2001 From: DROPDATABASE Date: Fri, 25 Apr 2025 11:22:22 +0300 Subject: [PATCH 6/6] Fixup --- .gitignore | 2 +- rating_api/routes/comment.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7f30d9d..b6e4761 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ __pycache__/ *.py[cod] *$py.class -*.DS_Store + # C extensions *.so diff --git a/rating_api/routes/comment.py b/rating_api/routes/comment.py index c3215d5..2a6d5aa 100644 --- a/rating_api/routes/comment.py +++ b/rating_api/routes/comment.py @@ -205,7 +205,7 @@ async def get_comments( comments = query.all() if not comments: - return CommentGetAll(polls=[], limit=limit, offset=offset, total=0) + raise ObjectNotFound(Comment, 'all') paginated = comments[offset : offset + limit] paginated.sort(key=lambda c: c.create_ts, reverse=True)