Skip to content

Commit

Permalink
feat(classes.ticket): create Ticket object
Browse files Browse the repository at this point in the history
  • Loading branch information
kaeeraa committed Dec 14, 2024
1 parent 2d6e21c commit 51c9c2c
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions classes/ticket.py
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})"

0 comments on commit 51c9c2c

Please sign in to comment.