Coverage for app/services/create_world_time.py: 33%
12 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-02 23:27 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-02 23:27 +0000
1from app.db.models import WorldTime
2from app.core.exceptions import WorldNotFoundError, DatabaseSaveError
3from datetime import datetime
5def create_world_time(id:int, db):
6 try:
7 world_time = WorldTime(
8 world_id = id,
9 world_date = datetime.now()
10 )
12 db.add(world_time)
13 db.commit()
14 db.refresh(world_time)
16 return world_time
18 except Exception as e:
19 raise DatabaseSaveError(str(e))