Exemple #1
0
 def post(self):
     post_args = self.args
     if post_args["id"]:
         del post_args['id']
     Permissions.create(post_args)
     return {
         "status": HTTPStatus.CREATED,
         "message": "Record Created"
     }, HTTPStatus.CREATED
Exemple #2
0
 def put(self):
     id = self.args.get("id")
     put_args = self.args
     if put_args["id"]:
         del put_args['id']
     Permissions.update(id, put_args)
     return {
         "status": HTTPStatus.ACCEPTED,
         "message": "Record Updated"
     }, HTTPStatus.ACCEPTED
Exemple #3
0
 def get(self):
     filter_dict = {}
     for key, value in self.args.items():
         if value is not None:
             filter_dict[key] = value
     if check_url_params_set(self.args):
         if self.args.get(
                 "id") is not None and not self.args.get("relation"):
             return Permissions.find(self.args.get("id"))
         else:
             results = Permissions.filter(filter_dict)
     else:
         results = Permissions.get_all()
     return results
Exemple #4
0
 def delete(self):
     Permissions.delete(self.args.get("id"))
     return {
         "status": HTTPStatus.ACCEPTED,
         "message": "Record Deleted"
     }, HTTPStatus.ACCEPTED