Skip to content

Conversation

@frereit
Copy link
Member

@frereit frereit commented Dec 1, 2021

fixes (partially) #3

Note that the generated files changed slightly because I changed the database layout, so I had to regenerate them. This means that front/graphql.schema.json and front/src/generated/graphql.ts contains a lot of changes, but these were all done automatically with a simple yarn codegen

This adds a new column "Last active" to the Users admin view.

changes

api

  • adds a new column to ctfnote.profile: COLUMN "lastactive" timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP;
  • adds a new type ctfnote.update_last_active_response which only contains a single boolean (ok)
  • adds a new function ctfnote.update_last_active() which sets the lastactive column of the current userid to now(), any user_guest may call this function.

Note that ctfnote.profile is SELECT-able by any logged in users. This means that using the API any user can view the last active date of any other users. I can change this if needed, but I since many forums also have a public "last online" date, I thought I'd make this internally public as well.

front

  • add lastactive to ProfileFragment and Profile
  • add new updateLastActive mutation
  • call updateLastActive mutation every time the user clicks a link
  • add user.profile.lastactive to Users.vue view

@frereit frereit requested a review from ElevenSpins December 1, 2021 14:12
@frereit frereit requested a review from JM-Lemmi January 22, 2022 18:39
@frereit frereit merged commit 12aa7b9 into main Jan 26, 2022
@frereit frereit deleted the feat/statistics branch January 26, 2022 19:52
JJ-8 added a commit to JJ-8/CTFNote that referenced this pull request May 5, 2023
The implementation is mostly based on DU4L#16
but we update the timer in the database instead of the frontend.
The update is done when the user fetches the profile,
so for every first load done in a new tab in the browser.

Please note that this commit can NOT be merged before TFNS#213
is merged since the migration files are now not consecutive.
The other PR contains a migration with ID 41, so this PR has a migration
with ID 42 (and this answers everything of course).
The migration will fail in this branch therefore. For testing, please
rename the file and use a throw away database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants