-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSN-2598 Added bookings and device_preferences
- Loading branch information
1 parent
5fc6892
commit 08e87d2
Showing
8 changed files
with
168 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
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,45 @@ | ||
class Booking: | ||
def __init__( | ||
self, | ||
id, | ||
type, | ||
device, | ||
user, | ||
event, | ||
created_at, | ||
updated_at, | ||
action, | ||
): | ||
self._id = id | ||
self.type = type | ||
self.device = device | ||
self.user = user | ||
self.event = event | ||
self.created_at = created_at | ||
self.created_at = updated_at | ||
self.action = action | ||
|
||
@classmethod | ||
def create_new( | ||
cls, | ||
type: str, | ||
device: str, | ||
user: str or None, | ||
event:str, | ||
created_at: str, | ||
updated_at: str, | ||
action: str, | ||
): | ||
return Booking( | ||
id=None, | ||
type=type, | ||
device=device, | ||
user=user, | ||
event=event, | ||
created_at=created_at, | ||
updated_at=updated_at, | ||
action=action, | ||
) | ||
|
||
def __repr__(self): | ||
return '<Booking(id={self.id!r}, type={self.type!r}, action={self.action!r})>'.format(self=self) |
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,34 @@ | ||
class DevicePreference: | ||
def __init__( | ||
self, | ||
id, | ||
created_at, | ||
device, | ||
venue, | ||
event, | ||
): | ||
self._id = id | ||
self.created_at = created_at | ||
self.device = device | ||
self.venue = venue | ||
self.event = event | ||
|
||
@classmethod | ||
def create_new( | ||
cls, | ||
created_at: str, | ||
device: str, | ||
venue: str or None, | ||
event: str or None, | ||
): | ||
return DevicePreference( | ||
id=None, | ||
device=device, | ||
venue=venue, | ||
event=event, | ||
created_at=created_at, | ||
) | ||
|
||
def __repr__(self): | ||
return '<DevicePreference(id={self.id!r}, device={self.device!r}, venue={self.venue!r}, event={self.event!r})>'\ | ||
.format(self=self) |
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
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
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,20 @@ | ||
from marshmallow import EXCLUDE, fields, Schema | ||
|
||
from livestyled.models.booking import Booking | ||
|
||
|
||
class BookingSchema(Schema): | ||
class Meta: | ||
unknown = EXCLUDE | ||
model = Booking | ||
api_type = 'bookings' | ||
url = 'v4/bookings' | ||
|
||
id = fields.Int() | ||
title = fields.String() | ||
device = fields.String() | ||
user = fields.String() | ||
event = fields.String() | ||
created_at = fields.String() | ||
updated_at = fields.String() | ||
action = fields.String() |
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,17 @@ | ||
from marshmallow import EXCLUDE, fields, Schema | ||
|
||
from livestyled.models.device_preference import DevicePreference | ||
|
||
|
||
class DevicePreferenceSchema(Schema): | ||
class Meta: | ||
unknown = EXCLUDE | ||
model = DevicePreference | ||
api_type = 'device_preferences' | ||
url = 'v4/device_preferences' | ||
|
||
id = fields.Int() | ||
created_at = fields.String() | ||
device = fields.String() | ||
venue = fields.String() | ||
event = fields.String() |
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