develop-entities #2
3 changed files with 8 additions and 24 deletions
|
@ -11,11 +11,4 @@ class Person:
|
||||||
Person entity initializer
|
Person entity initializer
|
||||||
"""
|
"""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.uuid = None
|
|
||||||
self.create()
|
|
||||||
|
|
||||||
def create(self):
|
|
||||||
if not self.uuid:
|
|
||||||
self.uuid = uuid.uuid1()
|
self.uuid = uuid.uuid1()
|
||||||
|
|
||||||
return self
|
|
||||||
|
|
|
@ -8,27 +8,16 @@ class Room:
|
||||||
Room entity
|
Room entity
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, card_type="fibonacci"):
|
def __init__(self, name: str, creator: uuid.UUID, card_type="fibonacci"):
|
||||||
"""
|
"""
|
||||||
Room entity initializer
|
Room entity initializer
|
||||||
"""
|
"""
|
||||||
self.name = name
|
self.name = name
|
||||||
self.uuid = None
|
self.creator = creator
|
||||||
|
self.uuid = uuid.uuid1()
|
||||||
self.attendant = []
|
self.attendant = []
|
||||||
self.card_type = card_type
|
self.card_type = card_type
|
||||||
self.cards = None
|
self.cards = self.assign_cards(card_type)
|
||||||
self.create()
|
|
||||||
|
|
||||||
def create(self):
|
|
||||||
"""
|
|
||||||
Method to create a new room object
|
|
||||||
"""
|
|
||||||
if not self.uuid:
|
|
||||||
self.uuid = uuid.uuid1()
|
|
||||||
|
|
||||||
self.assign_cards()
|
|
||||||
|
|
||||||
return self
|
|
||||||
|
|
||||||
def add_person(self, person: uuid.UUID):
|
def add_person(self, person: uuid.UUID):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,6 +11,8 @@ def create_room(person: uuid.UUID, name: str = None):
|
||||||
"""
|
"""
|
||||||
if not name:
|
if not name:
|
||||||
name = random.choice(ROOM_NAMES)
|
name = random.choice(ROOM_NAMES)
|
||||||
r = Room(name)
|
|
||||||
|
r = Room(name=name, creator=person)
|
||||||
r.add_person(person)
|
r.add_person(person)
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
Loading…
Reference in a new issue