@@ 144-167 (lines=24) @@ | ||
141 | data['type_action'] = 'Deleted Userstory' |
|
142 | return data |
|
143 | ||
144 | ||
145 | class Task(TaigaDomain): |
|
146 | def create(self, taiga_obj, data): |
|
147 | """ |
|
148 | ||
149 | :param taiga_obj: taiga object |
|
150 | :param data: data to return |
|
151 | :return: data |
|
152 | """ |
|
153 | if taiga_obj.notify_task_create: |
|
154 | data['type_action'] = 'New Task created' |
|
155 | return data |
|
156 | ||
157 | def change(self, taiga_obj, data): |
|
158 | """ |
|
159 | ||
160 | :param taiga_obj: taiga object |
|
161 | :param data: data to return |
|
162 | :return: data |
|
163 | """ |
|
164 | if taiga_obj.notify_task_change: |
|
165 | data['type_action'] = 'Changed Task' |
|
166 | return data |
|
167 | ||
168 | def delete(self, taiga_obj, data): |
|
169 | """ |
|
170 |
@@ 11-33 (lines=23) @@ | ||
8 | from th_slack.models import Slack |
|
9 | ||
10 | ||
11 | def consumer(trigger_id, data): |
|
12 | """ |
|
13 | call the consumer and handle the data |
|
14 | :param trigger_id: |
|
15 | :param data: |
|
16 | :return: |
|
17 | """ |
|
18 | status = True |
|
19 | # consumer - the service which uses the data |
|
20 | default_provider.load_services() |
|
21 | service = TriggerService.objects.get(id=trigger_id) |
|
22 | ||
23 | service_consumer = default_provider.get_service( |
|
24 | str(service.consumer.name.name)) |
|
25 | kwargs = {'user': service.user} |
|
26 | ||
27 | if len(data) > 0: |
|
28 | ||
29 | getattr(service_consumer, '__init__')(service.consumer.token, |
|
30 | **kwargs) |
|
31 | status = getattr(service_consumer, 'save_data')(service.id, **data) |
|
32 | ||
33 | return status |
|
34 | ||
35 | ||
36 | @api_view(['POST']) |