Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client-v3/src/components/config/ConfigUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</BButtonGroup>
</template>
<template #head(is_admin)>User Type</template>
<template #cell(created_on)="data">
{{ data.item.created_on ?? 'N/A' }}
</template>
<template #cell(last_login)="data">
{{ data.item.last_login ?? 'Never' }}
</template>
Expand Down Expand Up @@ -105,6 +108,7 @@ const selectedUser = ref<{ id: number; username: string } | null>(null);

const userFields = [
'username',
'created_on',
'last_login',
'last_seen',
{ key: 'is_admin', label: 'User Type' },
Expand Down
1 change: 1 addition & 0 deletions client-v3/src/types/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface User {
id: number;
username: string | null;
is_admin: boolean | null;
created_on: string | null;
last_login: string | null;
last_seen: string | null;
requires_password_change: boolean;
Expand Down
1 change: 1 addition & 0 deletions client/src/types/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface User {
id: number;
username: string | null;
is_admin: boolean | null;
created_on: string | null;
last_login: string | null;
last_seen: string | null;
requires_password_change: boolean;
Expand Down
12 changes: 11 additions & 1 deletion client/src/vue_components/config/ConfigUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</b-button-group>
</template>
<template #head(is_admin)="data"> User Type </template>
<template #cell(created_on)="data">
{{ data.item.created_on ? data.item.created_on : 'N/A' }}
</template>
<template #cell(last_login)="data">
{{ data.item.last_login ? data.item.last_login : 'Never' }}
</template>
Expand Down Expand Up @@ -93,7 +96,14 @@ export default defineComponent({
components: { CreateUser, ConfigRbac, ResetPassword },
data() {
return {
userFields: ['username', 'last_login', 'last_seen', 'is_admin', { key: 'btn', label: '' }],
userFields: [
'username',
'created_on',
'last_login',
'last_seen',
'is_admin',
{ key: 'btn', label: '' },
],
editUser: null as number | null,
resetUser: null as { id: number; username: string } | null,
clientTimeout: null as ReturnType<typeof setTimeout> | null,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Add created on timestamp tp users

Revision ID: 3f2343a8a936
Revises: 11311df29aa4
Create Date: 2026-06-06 23:49:09.107684

"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision: str = "3f2343a8a936"
down_revision: Union[str, None] = "11311df29aa4"

Check warning on line 17 in server/alembic_config/versions/3f2343a8a936_add_created_on_timestamp_tp_users.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a union type expression for this type hint.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ6fI9LMxuz03-S0dABu&open=AZ6fI9LMxuz03-S0dABu&pullRequest=1156
branch_labels: Union[str, Sequence[str], None] = None

Check warning on line 18 in server/alembic_config/versions/3f2343a8a936_add_created_on_timestamp_tp_users.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a union type expression for this type hint.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ6fI9LMxuz03-S0dABv&open=AZ6fI9LMxuz03-S0dABv&pullRequest=1156
depends_on: Union[str, Sequence[str], None] = None

Check warning on line 19 in server/alembic_config/versions/3f2343a8a936_add_created_on_timestamp_tp_users.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a union type expression for this type hint.

See more on https://sonarcloud.io/project/issues?id=dreamteamprod_DigiScript&issues=AZ6fI9LMxuz03-S0dABw&open=AZ6fI9LMxuz03-S0dABw&pullRequest=1156


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("user", schema=None) as batch_op:
batch_op.add_column(sa.Column("created_on", sa.DateTime(), nullable=True))

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("user", schema=None) as batch_op:
batch_op.drop_column("created_on")

# ### end Alembic commands ###
1 change: 1 addition & 0 deletions server/controllers/api/auth/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async def post(self):
username=username,
password=hashed_password,
is_admin=is_admin,
created_on=datetime.now(tz=timezone.utc),
)
)
session.commit()
Expand Down
1 change: 1 addition & 0 deletions server/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class User(db.Model):
username: Mapped[str | None] = mapped_column(index=True)
password: Mapped[str | None] = mapped_column()
is_admin: Mapped[bool | None] = mapped_column()
created_on: Mapped[datetime.datetime | None] = mapped_column()
last_login: Mapped[datetime.datetime | None] = mapped_column()
last_seen: Mapped[datetime.datetime | None] = mapped_column()
api_token: Mapped[str | None] = mapped_column(index=True)
Expand Down
Loading