adds calendar_type to calendar model and to calendar handling
This commit is contained in:
parent
2add28fa00
commit
524d2f1e1d
2
backend
2
backend
@ -1 +1 @@
|
||||
Subproject commit 45cd71cc4bcddf23f46b1eddcffd8c7fda2b9d41
|
||||
Subproject commit fec09edb888013c5cb9c062d5cdb2220bc1a217d
|
@ -67,6 +67,7 @@ class Calendar(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), index=True, nullable=False)
|
||||
calendar_id = db.Column(db.String(256), primary_key=True)
|
||||
calendar_type = db.Column(db.String(32), index=True)
|
||||
name = db.Column(db.String(256), index=True)
|
||||
toggle = db.Column(db.String(8))
|
||||
color = db.Column(db.String(16))
|
||||
|
@ -130,7 +130,7 @@ def fetchCalendarEvents(user, calendars, startDate, endDate):
|
||||
|
||||
all_events = []
|
||||
for calendar in calendars:
|
||||
if calendar.toggle == "True":
|
||||
if calendar.toggle == "True" and calendar.calType == "Google":
|
||||
event_result = service.events().list(calendarId=calendar.calendar_id,
|
||||
timeMin=startDate,
|
||||
timeMax=endDate,
|
||||
@ -178,6 +178,7 @@ def fetchCalendars():
|
||||
calendar_list = service.calendarList().list(pageToken=page_token).execute()
|
||||
for calendar in calendar_list['items']:
|
||||
calendars.append(Calendar(name=calendar['summary'],
|
||||
calType="Google",
|
||||
calendarId=calendar['id'],
|
||||
color=calendar['colorId']))
|
||||
page_token = calendar_list.get('nextPageToken')
|
||||
|
Loading…
Reference in New Issue
Block a user