Skip to content

Commit 4627cdd

Browse files
committed
chore: change mongodb collection names to follow best practices
1 parent e100dfc commit 4627cdd

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

app/models/auth/api_key.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime
2+
from typing import ClassVar
23

34
from odmantic import Field, Model
45

@@ -10,3 +11,7 @@ class ApiKey(Model):
1011
created_at: datetime = Field(default_factory=datetime.now)
1112
expires_at: datetime
1213
is_active: bool = True
14+
15+
model_config: ClassVar[dict[str, str]] = {
16+
"collection": "api_keys"
17+
}

app/models/auth/revoked_token.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
from datetime import datetime
2+
from typing import ClassVar
23

34
from odmantic import Model
45

56

67
class RevokedToken(Model):
78
token: str
89
expires_at: datetime
10+
11+
model_config: ClassVar[dict[str, str]] = {
12+
"collection": "revoked_tokens"
13+
}

app/models/auth/user.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
from typing import ClassVar
2+
13
from odmantic import Model
24
from pydantic import EmailStr
35

46

57
class User(Model):
68
email: EmailStr
79
password: str
10+
11+
model_config: ClassVar[dict[str, str]] = {
12+
"collection": "users"
13+
}

0 commit comments

Comments
 (0)