backend.models
SQLAlchemy ORM models for libreStage.
Defines all database tables as Python classes. Every model that maps to
a table inherits from Base.
- Helper:
time_to_str()– convertsdatetime.time/datetime.dateobjects to ISO strings for serialisation.
- backend.models.time_to_str(t)[Quellcode]
- class backend.models.User(**kwargs)[Quellcode]
Bases:
BaseRegistered application user.
- id
- user_name
- user_pw
- user_group
- email
- clear_name
- musician
- is_singer
- mm_username
- status
- class backend.models.UsedPasswordResetToken(**kwargs)[Quellcode]
Bases:
BaseRecord of password-reset tokens that have already been consumed.
- used_at
Timestamp when the token was used.
- Type:
datetime
- id
- token_hash
- used_at
- class backend.models.RefreshToken(**kwargs)[Quellcode]
Bases:
BasePersistent refresh token linked to a user.
- expires_at
Expiry timestamp (UTC).
- Type:
datetime
- created_at
Creation timestamp (UTC).
- Type:
datetime
- id
- token_hash
- user_id
- expires_at
- created_at
- revoked
- user
- class backend.models.TokenBlacklist(**kwargs)[Quellcode]
Bases:
BaseBlacklisted access tokens (e.g. after explicit logout).
- blacklisted_at
Timestamp of blacklisting (UTC).
- Type:
datetime
- expires_at
Original token expiry – used for cleanup.
- Type:
datetime
- id
- token_hash
- blacklisted_at
- expires_at
- class backend.models.RehTodo(**kwargs)[Quellcode]
Bases:
BaseA to-do item assigned to a specific user for a song in a rehearsal.
- dt
Optional due date/time.
- Type:
datetime | None
- id
- id_song
- id_reh
- id_user
- todo
- dt
- done
- class backend.models.RehSong(**kwargs)[Quellcode]
Bases:
BaseAssociation between a
Rehearsaland aSong.Stores per-song rehearsal metadata (comment, to-do text, done flag) and exposes several hybrid properties that proxy attributes of the related
Song.- id
- id_rehearsal
- id_song
- comment
- todo
- done
- title
- interpret
- status
- setlist_comment
- song_todos
- rehearsal
- song
- todos
- class backend.models.Rehearsal(**kwargs)[Quellcode]
Bases:
BaseA single band rehearsal session.
- begin
Start time.
- Type:
datetime
- end
End time.
- Type:
datetime
- songs
- class backend.models.Gig(**kwargs)[Quellcode]
Bases:
BaseA band performance (gig / concert).
- doors
Doors-open time.
- Type:
time | None
- begin
Start time of the performance.
- Type:
time | None
- end
End time of the performance.
- Type:
time | None
- id
- name
- organizer
- kind_of_gig
- venue
- doors
- begin
- end
- status
- publish
- schedule_items: Mapped[list[GigScheduleItem]]
- debug_dump(schedule=None)[Quellcode]
Print a human-readable overview of the gig structure to stdout.
- Parameter:
schedule (dict | None) – Optional timing schedule as returned by
services.setlist.SetlistService.calc_schedule().
- to_dict(include_song_details=True)[Quellcode]
Serialise the gig and its full set list to a plain dictionary.
- class backend.models.Song(**kwargs)[Quellcode]
Bases:
BaseA song in the band’s repertoire.
- duration
Song duration.
- Type:
time | None
- feedbacks
Candidate feedback entries.
- Type:
- id
- title
- interpret
- genre
- singer_background
- singer_lead
- composer
- texter
- publisher
- arrangement
- text
- tone_key
- status
- comment
- ytlink
- duration
- brass
- rehearsal_links
- feedbacks
- to_setlist_dict()[Quellcode]
Serialise the song to a dictionary suitable for setlist display.
- Rückgabe:
Song fields used in setlist views (title, interpret, genre, singers, duration, brass, tone_key, status, comment).
- Rückgabetyp:
- to_setlist_element()[Quellcode]
Like
to_setlist_dict()but addssong_idand a placeholdersetsong_idof-1.- Rückgabe:
Extended setlist dictionary with
song_idandsetsong_id.- Rückgabetyp:
- class backend.models.SongCandidateFeedback(**kwargs)[Quellcode]
Bases:
BaseUser feedback on a song candidate (proposal).
- date
Timestamp of the feedback.
- Type:
datetime
- id
- song_id
- user_id
- date
- feedback
- song
- class backend.models.Set(**kwargs)[Quellcode]
Bases:
BaseA named set of songs within a gig.
- pause
Duration of the break after this set (default 10 min).
- Type:
time
- to_setlist_dict()[Quellcode]
Minimal serialisation of the set (currently only
id).- Rückgabe:
{"id": self.id}- Rückgabetyp:
- class backend.models.SetSong(**kwargs)[Quellcode]
Bases:
BaseAssociation between a
Setand aSong, including position and live-mode state.- to_setlist_dict()[Quellcode]
Serialise the set–song association for setlist views.
Returns a fallback entry with a warning title if the linked song has been deleted.
- Rückgabe:
Song fields plus
song_id,setsong_id,position,eingeschoben,uebersprungenandfeedback.- Rückgabetyp:
- class backend.models.GigSet(**kwargs)[Quellcode]
Bases:
Base
- class backend.models.GigScheduleItem(**kwargs)[Quellcode]
Bases:
BaseAdditional freely editable timeline items for a gig.
- id
- gig_id
- item_datetime
- was
- wer
- wo
- class backend.models.Surveys(**kwargs)[Quellcode]
Bases:
BaseA feedback survey created by an admin or editor.
- release_date
Date/time the survey was released.
- Type:
datetime
- datum
Creation date.
- Type:
datetime
- fields
Individual questions / fields.
- Type:
- id
- kind_of_survey
- rf_survey
- released
- closed
- user_created
- release_date
- fields
- datum
- class backend.models.SurveyFields(**kwargs)[Quellcode]
Bases:
BaseA single question or rating field within a
Surveys.- feedbacks
Responses to this field.
- Type:
- id
- id_survey
- field_text
- feedbacks
- class backend.models.SurveyFeedback(**kwargs)[Quellcode]
Bases:
BaseA user’s response to a single
SurveyFieldsentry.- id_sv_field
Foreign key to
SurveyFields.- Type:
- datum
Timestamp of the response.
- Type:
datetime
- id
- id_sv_field
- id_user
- datum
- value
- comment