여러 줄 주석이 설명보다 경위(예전·실측·지적)를 적고 있어 읽는 사람이 결론을 찾기 어려웠다. - ts·tsx·js·mjs·css·py 478개: 여러 줄 주석은 첫 문장 한 줄로, 과거형·날짜 문장은 삭제 - 주석 위치는 TypeScript 파서·파이썬 tokenize/ast 로 찾는다 — 문자열 안의 # · /* 는 건드리지 않는다 - eslint·ts·noqa·type: ignore 같은 지시 주석은 그대로 둔다 파이썬 275개 정리 전후 AST 동일, TS 298개 주석 뺀 토큰 동일(빈 JSX 주석 10곳만 차이). site·frontend·admin tsc, site vitest 105 passed Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from sqlalchemy import and_, select, update
|
|
|
|
from common.database.db_session_manager import DB_SESSION_MNG
|
|
from common.database.model.models import place_songs
|
|
from common.enums import SongStatus
|
|
from common.utils.gtime import GTime
|
|
|
|
|
|
class SongCRUD:
|
|
"""place_songs 접근."""
|
|
|
|
async def insert(self, db, row):
|
|
return await DB_SESSION_MNG.insert(db, row)
|
|
|
|
async def update(self, db, song_id, data: dict):
|
|
return await DB_SESSION_MNG.add_with_rowcount(
|
|
db,
|
|
update(place_songs)
|
|
.where(place_songs.song_id == song_id, place_songs.deleted == False) # noqa: E712
|
|
.values(**data, updated_at=GTime.UTC()),
|
|
)
|
|
|
|
async def latest_ready(self, db, place_id):
|
|
"""이 업장의 **가장 최근에 완성된** 곡 하나."""
|
|
return await DB_SESSION_MNG.execute(
|
|
db,
|
|
select(place_songs)
|
|
.where(and_(
|
|
place_songs.place_id == place_id,
|
|
place_songs.status == SongStatus.READY.value,
|
|
place_songs.deleted == False, # noqa: E712
|
|
))
|
|
.order_by(place_songs.created_at.desc())
|
|
.limit(1),
|
|
)
|