- Arquitetura corrigida: templates agora pertencem à inbox (WhatsApp),
não à unidade PIX (que é uma config financeira, não de mensagens)
- Migration: troca FK captain_unit_id -> inbox_id (up/down explícito)
- Model: belongs_to :inbox; scope for_inbox
- Controller: escopo via account.inboxes.find(inbox_id)
- Rotas: move de captain/units/:id → inboxes/:id/notification_templates
- Scanner job: joins(:conversation).where(conversations: {inbox_id:})
- UI: página /captain/notifications com seletor de inbox no topo
(chips clicáveis, templates carregam por watch no selectedInboxId)
- i18n PT/EN: novas keys INBOX_LABEL, SELECT_INBOX_HINT, EMPTY
30 lines
667 B
JavaScript
30 lines
667 B
JavaScript
import ApiClient from '../ApiClient';
|
|
|
|
class NotificationTemplatesAPI extends ApiClient {
|
|
constructor() {
|
|
super('inboxes', { accountScoped: true });
|
|
}
|
|
|
|
getAll(inboxId) {
|
|
return this.get(`${inboxId}/notification_templates`);
|
|
}
|
|
|
|
create(inboxId, data) {
|
|
return this.post(`${inboxId}/notification_templates`, {
|
|
notification_template: data,
|
|
});
|
|
}
|
|
|
|
update(inboxId, id, data) {
|
|
return this.patch(`${inboxId}/notification_templates/${id}`, {
|
|
notification_template: data,
|
|
});
|
|
}
|
|
|
|
delete(inboxId, id) {
|
|
return this.delete(`${inboxId}/notification_templates/${id}`);
|
|
}
|
|
}
|
|
|
|
export default new NotificationTemplatesAPI();
|