Skip to content

Commit aa6fadb

Browse files
authored
add type annotation for id (#197)
* add type annotation for `id` * do the same for `TokenAuth` table
1 parent 99077f5 commit aa6fadb

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

piccolo_api/session_auth/tables.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import typing as t
55
from datetime import datetime, timedelta
66

7-
from piccolo.columns import Integer, Timestamp, Varchar
7+
from piccolo.columns import Integer, Serial, Timestamp, Varchar
88
from piccolo.columns.defaults.timestamp import TimestampOffset
99
from piccolo.table import Table
1010
from piccolo.utils.sync import run_sync
@@ -15,6 +15,8 @@ class SessionsBase(Table, tablename="sessions"):
1515
Use this table, or inherit from it, to create a session store.
1616
"""
1717

18+
id: Serial
19+
1820
#: Stores the session token.
1921
token: Varchar = Varchar(length=100, null=False)
2022

piccolo_api/token_auth/tables.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import uuid
55

66
from piccolo.apps.user.tables import BaseUser
7-
from piccolo.columns.column_types import ForeignKey, Varchar
7+
from piccolo.columns.column_types import ForeignKey, Serial, Varchar
88
from piccolo.table import Table
99
from piccolo.utils.sync import run_sync
1010

@@ -24,6 +24,7 @@ class TokenAuth(Table):
2424
web usage.
2525
"""
2626

27+
id: Serial
2728
token = Varchar(default=generate_token)
2829
user = ForeignKey(references=BaseUser)
2930

0 commit comments

Comments
 (0)