- Adds create methods to the room, person and cards - Adds methods to add and remove person from room
40 lines
812 B
Python
40 lines
812 B
Python
import uuid
|
|
|
|
class Room:
|
|
"""
|
|
Room entity
|
|
"""
|
|
|
|
def __init__(self, name):
|
|
"""
|
|
Room entity initializer
|
|
"""
|
|
self.name = name
|
|
self.uuid = None
|
|
self.attendant = []
|
|
self.create()
|
|
|
|
|
|
def create(self):
|
|
"""
|
|
Method to create a new room object
|
|
"""
|
|
if not self.uuid:
|
|
self.uuid = uuid.uuid1()
|
|
|
|
return self
|
|
|
|
|
|
def add_person(self, person: uuid.UUID):
|
|
"""
|
|
Method to add a person to a room
|
|
"""
|
|
if person not in self.attendant:
|
|
self.attendant.append(person)
|
|
|
|
def remove_person(self, person: uuid.UUID):
|
|
"""
|
|
Method to remove a person from a room
|
|
"""
|
|
if person in self.attendant:
|
|
self.attendant.remove(person)
|