feat(playevents): add Writer with start/end/skipped/synthetic paths
Owns the auto-close-prior step (caps each user at one open row), spec §6 skip classification rule on play_ended (AND of completion < 0.5 and duration_played < 30s), and skip_events row writes. Synthetic completed play wires the Subsonic /rest/scrobble?submission=true path into the same store as native events.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
// source: albums.sql
|
||||
|
||||
package dbq
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
// source: artists.sql
|
||||
|
||||
package dbq
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
|
||||
package dbq
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
|
||||
package dbq
|
||||
|
||||
@@ -29,6 +29,31 @@ type Artist struct {
|
||||
UpdatedAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type PlayEvent struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
TrackID pgtype.UUID
|
||||
SessionID pgtype.UUID
|
||||
StartedAt pgtype.Timestamptz
|
||||
EndedAt pgtype.Timestamptz
|
||||
DurationPlayedMs *int32
|
||||
CompletionRatio *float64
|
||||
WasSkipped bool
|
||||
ClientID *string
|
||||
SessionVectorAtPlay []byte
|
||||
ScrobbledAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type PlaySession struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
StartedAt pgtype.Timestamptz
|
||||
EndedAt pgtype.Timestamptz
|
||||
LastEventAt pgtype.Timestamptz
|
||||
TrackCount int32
|
||||
ClientID *string
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
@@ -38,6 +63,15 @@ type Session struct {
|
||||
LastSeenAt pgtype.Timestamptz
|
||||
}
|
||||
|
||||
type SkipEvent struct {
|
||||
ID pgtype.UUID
|
||||
UserID pgtype.UUID
|
||||
TrackID pgtype.UUID
|
||||
SessionID pgtype.UUID
|
||||
SkippedAt pgtype.Timestamptz
|
||||
PositionMs int32
|
||||
}
|
||||
|
||||
type Track struct {
|
||||
ID pgtype.UUID
|
||||
Title string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
// source: sessions.sql
|
||||
|
||||
package dbq
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
// source: tracks.sql
|
||||
|
||||
package dbq
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.27.0
|
||||
// sqlc v1.31.1
|
||||
// source: users.sql
|
||||
|
||||
package dbq
|
||||
|
||||
Reference in New Issue
Block a user