delete_recordset.py 2.26 KB
Newer Older
Jonas Waeber's avatar
Jonas Waeber committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Import API Service
# Copyright (C) 2020-2021 Memobase Project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
Matthias's avatar
Matthias committed
16
from flask_restful import Resource, request
Jonas Waeber's avatar
Jonas Waeber committed
17
from import_api_app.resources.delete_service import DeleteService
Matthias's avatar
Matthias committed
18
19
20
21


class DeleteRecordset(Resource):

22
    def post(self, session_id, dryrun=False):
Matthias's avatar
Matthias committed
23
24
25
26
27
28
29
30
31
32
33
34
        """
        Tells the import process deleter to delete a recordset
        ---
        tags:
          - delete service
        parameters:
          - in: path
            name: session_id
            required: true
            description: A session id used to distinguish between different runs.
            example: uuid
            type: string
35
36
37
38
39
40
41
          - in: path
            name: dryrun
            required: false
            description: True if you want to do a dryrun, otherwise False
            example: True
            type: boolean
            default: True
Matthias's avatar
Matthias committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
          - in: body
            name: body
            schema:
              id: recordset_id
              properties:
                recordset_id:
                  type: string
                  example: sik-001
                  description: The id of the recordset to delete
        responses:
          200:
            description: Success, recordset to delete has been found and delete service called
            schema:
              properties:
                status:
                  type: string
                  example: SUCCESS/FAILURE
                  enum: ['SUCCESS', 'FAILURE']

        """

        # get recordset_id parameter from request-body
        recordset_id = request.json['recordset_id']
65
        return DeleteService.delete_recordset(DeleteService, recordset_id, session_id, dryrun)