Exemple #1
0
    def put(self, id_):
        args = DataResource.parser.parse_args()
        mock_data = MockData.query.filter(MockData.status != -1, MockData.id == id_).first_or_404()
        mock_data = MockDataSchema().load(args, instance=mock_data)

        with db.auto_commit():
            db.session.add(mock_data)
        return UpdateSuccess()
Exemple #2
0
 def get(self):
     args = self.parser.parse_args()
     mock_data = MockData.query.filter(
         MockData.status != -1,
         MockData.project_id == args.project_id,
         (MockData.id != args.parent_id) if args.parent_id else text(''),
         (MockData.method == args.method) if args.method else text(''),
         (MockData.url == args.url) if args.url else text(''),
         (MockData.match_type == args.match_type) if args.match_type else text(''),
     ).all()
     data = MockDataSchema().dump(mock_data, many=True)
     return Success(data=data)
Exemple #3
0
 def get(self, id_):
     mock_data = MockData.query.filter(MockData.status != -1,
                                       MockData.id == id_).first_or_404()
     data = MockDataSchema().dump(mock_data)
     return Success(data=data)
Exemple #4
0
 def post(self):
     args = self.parser.parse_args()
     mock_data = MockDataSchema().load(args)
     with db.auto_commit():
         db.session.add(mock_data)
     return CreateSuccess()