예제 #1
0
    def post(self):
        args = get_args()

        if check_schedule(args):
            return response("There is a conflict in schedule", 409)

        schedule = Schedule()
        fill_schedule(schedule, args)
        schedule.active = True
        schedule.lastUpdate = datetime.now()
        schedule.update()
        return schema.dump(schedule).data, 201
예제 #2
0
User.query.delete()

user = User(name="uName",
            email="*****@*****.**",
            uid="000000000",
            userType=UserTypesEnum.PROFESSOR)
user.add(user)
print("User ID {}\n".format(user.id))

room = Room()
room.name = "E003"

roomUser = RoomUser()
roomUser.user = user

room.users.append(roomUser)
room.active = True
room.add(room)
print("Room ID {}\n".format(room.id))

schedule = Schedule()
schedule.room = room
schedule.userType = UserTypesEnum.PROFESSOR
schedule.dayOfWeek = DaysOfWeekEnum.MONDAY
schedule.beginTime = datetime.now().hour
schedule.endTime = datetime.now().hour
schedule.lastUpdate = datetime.now()
schedule.active = True
schedule.add(schedule)
print("Schedule ID {}\n".format(schedule.id))