-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(classes.ticket): create Ticket object
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""This module contains the Ticket class.""" | ||
from datetime import datetime | ||
from enum import Enum | ||
from hikari import User | ||
|
||
|
||
class Status(Enum): | ||
""" | ||
Ticket status enumeration. | ||
This enumeration contains the different statuses that a ticket can have. | ||
""" | ||
OPEN = "open" | ||
IN_PROGRESS = "in_progress" | ||
RESOLVED = "resolved" | ||
CLOSED = "closed" | ||
|
||
|
||
class Ticket: | ||
""" | ||
Ticket class. | ||
This class represents a ticket and its attributes. | ||
""" | ||
|
||
def __init__(self, | ||
ticketId: int, | ||
author: User, | ||
authorId: int, | ||
title: str, | ||
description: str, | ||
status: Status = Status.OPEN): | ||
self.ticketId = ticketId | ||
self.author = author | ||
self.authorId = authorId | ||
self.title = title | ||
self.description = description | ||
self.status = status | ||
self.createdAt = datetime.now() | ||
self.updatedAt = datetime.now() | ||
|
||
def changeStatus(self, status: Status): | ||
""" | ||
Changes the status of the ticket to the specified status. | ||
Args: | ||
status (Status): The status to change the ticket to. | ||
""" | ||
self.status = status | ||
self.updatedAt = datetime.now() | ||
|
||
def __repr__(self): | ||
return f"Ticket({self.ticketId}, {self.title}, Status: {self.status})" |