diff options
author | Sybren <122987084+drsybren@users.noreply.github.com> | 2023-02-16 17:32:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-16 10:32:01 -0600 |
commit | aa45777c926adba2bbe9e269960476acf55abb33 (patch) | |
tree | bcf28d4a45eb80c9598b827b6c7bc284416b0790 /templates/swagger | |
parent | a0b9767df8720578910d49437db37dc34821bd0b (diff) | |
download | gitea-aa45777c926adba2bbe9e269960476acf55abb33.tar.gz gitea-aa45777c926adba2bbe9e269960476acf55abb33.zip |
Allow custom "created" timestamps in user creation API (#22549)
Allow back-dating user creation via the `adminCreateUser` API operation.
`CreateUserOption` now has an optional field `created_at`, which can
contain a datetime-formatted string. If this field is present, the
user's `created_unix` database field will be updated to its value.
This is important for Blender's migration of users from Phabricator to
Gitea. There are many users, and the creation timestamp of their account
can give us some indication as to how long someone's been part of the
community.
The back-dating is done in a separate query that just updates the user's
`created_unix` field. This was the easiest and cleanest way I could
find, as in the initial `INSERT` query the field always is set to "now".
Diffstat (limited to 'templates/swagger')
-rw-r--r-- | templates/swagger/v1_json.tmpl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index e096faf3f3..00fc3b60c4 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -15809,6 +15809,12 @@ "password" ], "properties": { + "created_at": { + "description": "For explicitly setting the user creation timestamp. Useful when users are\nmigrated from other systems. When omitted, the user's creation timestamp\nwill be set to \"now\".", + "type": "string", + "format": "date-time", + "x-go-name": "Created" + }, "email": { "type": "string", "format": "email", |