ticket.model

Attributes

TicketState

Classes

Ticket

Defines a ticket.

TicketPermission

Defines a custom ticket permission.

Module Contents

ticket.model.TicketState[source]
class ticket.model.Ticket[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin, onegov.search.ORMSearchable

Defines a ticket.

__tablename__ = 'tickets'[source]
id: Column[uuid.UUID][source]
number: Column[str][source]
title: Column[str][source]
subtitle: Column[str | None][source]
group: Column[str][source]
handler_code: Column[str][source]
handler_id: Column[str][source]
handler_data: Column[dict[str, Any]][source]
snapshot: Column[dict[str, Any]][source]
last_state_change: Column[datetime | None][source]
reaction_time: Column[int | None][source]
process_time: Column[int | None][source]
muted: Column[bool][source]
created: sqlalchemy.Column[datetime.datetime][source]
state: Column[TicketState][source]
user_id: Column[uuid.UUID | None][source]
user: relationship[User | None][source]
__mapper_args__[source]
es_public = False[source]

Returns True if the model is available to be found by the public. If false, only editors/admins will see this object in the search results.

es_properties[source]

Returns the type mapping of this model. Each property in the mapping will be read from the model instance.

The returned object needs to be a dict or an object that provides a to_dict method.

Internally, onegov.search stores differing languages in different indices. It does this automatically through langauge detection, or by manually specifying a language.

Note that objects with multiple languages are not supported (each object is supposed to have exactly one language).

Onegov.search will automatically insert the right analyzer for types like these.

There’s currently only limited support for properties here, namely objects and nested mappings do not work! This is going to be added in the future though.

property extra_localized_text: str | None[source]

Maybe used by child-classes to return localized extra data that should be indexed as well.

property es_suggestion: list[str][source]

Returns suggest-as-you-type value of the document. The field used for this property should also be indexed, or the suggestion will lead to nowhere.

If a single string is returned, the completion input equals the completion output. (My Title -> My Title)

If an array of strings is returned, all values are possible inputs and the first value is the output. (My Title/Title My -> My Title)

property ticket_email: str | None[source]
property ticket_data: Sequence[str] | None[source]
redact_data() None[source]

Redact sensitive information from the ticket to protect personal data.

In scenarios where complete deletion is not feasible, this method serves as an alternative by masking sensitive information, like addresses, phone numbers in the form submission.

property handler: onegov.ticket.handler.Handler[source]

Returns an instance of the handler associated with this ticket.

property current_process_time: int | None[source]
accept_ticket(user: onegov.user.User) None[source]
close_ticket() None[source]
reopen_ticket(user: onegov.user.User) None[source]
archive_ticket() None[source]
unarchive_ticket(user: onegov.user.User) None[source]
create_snapshot(request: onegov.core.request.CoreRequest) None[source]

Takes the current handler and stores the output of the summary as a snapshot.

TODO: This doesn’t support multiple langauges at this point. The language of the user creating the snapshot will be what’s stored.

In the future we might change this by iterating over all supported languages and creating the summary for each language.

class ticket.model.TicketPermission[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin

Defines a custom ticket permission.

If a ticket permission is defined for ticket handler (and optionally a group), a user has to be in the given user group to access these tickets.

__tablename__ = 'ticket_permissions'[source]
id: Column[uuid.UUID][source]
user_group_id: Column[uuid.UUID][source]
user_group: relationship[UserGroup][source]
handler_code: Column[str][source]
group: Column[str | None][source]