Collecting usage info, change sqlite lib.
continuous-integration/drone/push Build is passing

* X-User-ID header is processed to get user ID.
* Time of last request for a user is saved into DB.
* Time of last upload and download is stored for a user.
* Added DB migration to add columns into users table to store the times and app version.
* Backward fix of datatype of the deadline column in features table.
* Switched from crawshaw.io/sqlite to zombiezen.com/go/sqlite.
  * Refactored DB handling.
  * Used migration routine from zombiezen in favour of manual one.
  * Runtime DB reinit simply deletes the db file and initializes the db anew.

Fix #6
This commit is contained in:
zegkljan
2023-06-11 18:06:33 +02:00
parent 63e79c657c
commit 8440e3b7d7
11 changed files with 740 additions and 475 deletions
+8
View File
@@ -19,6 +19,14 @@ type User struct {
Name string `json:"name"`
}
type UserInfo struct {
User
AppVersion *semver.Version `json:"app_version"`
LastSeenTime *time.Time `json:"last_seen_time"`
LastUploadTime *time.Time `json:"last_upload_time"`
LastDownloadTime *time.Time `json:"last_download_time"`
}
type Feature struct {
// ID is an ID of the feature.
// When the feature is submitted by a client for creation (i.e. in Update.Create) it is considered a 'local' ID which must be unique across all submitted features.