Пример #1
0
def add_note():
    user_id = get_jwt_identity()

    body = request.get_json()

    user = User.objects.get(id=user_id)
    note = Note(**body, added_by=user)
    note.save()

    response = make_response({"status": "success", "note": note})

    return response
Пример #2
0
 def post(self):
     try:
         user_id = get_jwt_identity()
         body = request.get_json()
         user = User.objects.get(id=user_id)
         note = Note(**body, added_by=user)
         note.save()
         user.update(push__notes=note)
         user.save()
         id = note.id
         return {'id': str(id)}, 200
     except (FieldDoesNotExist, ValidationError):
         raise SchemaValidationError
     except NotUniqueError:
         raise NoteAlreadyExistsError
     except Exception as e:
         raise InternalServerError
Пример #3
0
def add_note():
    description = request.json['description']
    title = request.json['title']
    rentalID = request.json['rentalID']
    rental = dq.getRentalByRentalID(rentalID)
    board = rental.board
    category = request.json['category']
    note = Note(description=description, title=title, board=board,
                category=category)
    dq.add(note)
    return jsonify({}), 201
Пример #4
0
def add_note(note, meeting_id, student_id, time, status=None):
    '''
    '''
    new_note = Note(details=note,
                    status=status,
                    meeting_id=meeting_id,
                    student_id=student_id,
                    time=time)
    db.session.add(new_note)
    db.session.commit()
    print('Note added')
Пример #5
0
 def get(self):
     nott = Note.objects().to_json()
     return Response(nott, mimetype="application/json", status=200)
Пример #6
0
 def post(self):
     body = request.get_json()
     print("bbbb", body)
     nott = Note(**body).save()
     id = nott.id
     return {'id': str(id)}, 200
Пример #7
0
def get_notes():
    user_id = get_jwt_identity()
    notes = Note.objects(added_by=user_id)
    response = make_response({"status": "success", "notes": notes})
    return response, 200