Package de.bytestore.hostinger.handler
Class TicketService
java.lang.Object
de.bytestore.hostinger.handler.TicketService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMessage(User user, Ticket ticketIO, String contentIO) Creates a new ticket message.createTicket(User authorIO, String titleIO, TicketPriority priorityIO) Creates a new ticket.intRetrieves the maximum age for a support pin.Retrieves a list of new support tickets from the database.Retrieves a ticket object from the database based on the given ID.voidload()This method is used to load a listener for new support tickets.voidonApplicationStarted(org.springframework.boot.context.event.ApplicationStartedEvent event) voidrenewSupportPin(User userIO)
-
Constructor Details
-
TicketService
public TicketService()
-
-
Method Details
-
onApplicationStarted
@EventListener public void onApplicationStarted(org.springframework.boot.context.event.ApplicationStartedEvent event) -
load
public void load()This method is used to load a listener for new support tickets. It adds a listener to the systemService that listens for an event called "support.tickets.new". The listener gets the count of new tickets by invoking the private method countNewTickets(). -
getNewTickets
Retrieves a list of new support tickets from the database.- Returns:
- A list of new support tickets.
-
createTicket
Creates a new ticket.- Parameters:
authorIO- The author of the ticket.titleIO- The title of the ticket.priorityIO- The priority of the ticket.- Returns:
- The created ticket object.
-
createMessage
Creates a new ticket message.- Parameters:
user- The user who created the message.ticketIO- The ticket object associated with the message.contentIO- The content of the message.- Returns:
- The created ticket message object.
-
getTicket
Retrieves a ticket object from the database based on the given ID.- Parameters:
idIO- The ID of the ticket to be retrieved.- Returns:
- The ticket object with the given ID, or null if no matching ticket is found.
-
renewSupportPin
-
getMaxPinAge
public int getMaxPinAge()Retrieves the maximum age for a support pin.- Returns:
- The maximum age for a support pin in days.
-