1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-21 21:32:59 +00:00

Conversation Mapper addition + migration to proper scheme

This commit is contained in:
Loic Blot
2016-11-11 11:53:26 +01:00
parent 42dbd2c3bf
commit 26df3a53a4
7 changed files with 220 additions and 52 deletions
+32
View File
@@ -201,6 +201,38 @@
</field>
</declaration>
</table>
<table>
<name>*dbprefix*ocsms_conversation_read_states</name>
<declaration>
<field>
<name>user_id</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>phone_number</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>int_date</name>
<type>integer</type>
<length>32</length>
<notnull>true</notnull>
</field>
<index>
<name>sms_conversation_rs_pkey</name>
<field>
<name>user_id</name>
</field>
<field>
<name>phone_number</name>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*ocsms_config</name>
<declaration>
+8 -2
View File
@@ -6,15 +6,21 @@
<description>A app to sync SMS with your ownCloud</description>
<licence>agpl</licence>
<author>Loic Blot</author>
<version>1.9.0</version>
<version>1.10.0</version>
<dependencies>
<owncloud min-version="8.1" max-version="9.2" />
<nextcloud min-version="9.0" />
</dependencies>
<ocsid>167289</ocsid>
<website>https://github.com/nerzhul/ocsms</website>
<bugs>https://github.com/nerzhul/ocsms/issues</bugs>
<repository type="git">https://github.com/nerzhul/ocsms</repository>
<repair-steps>
<post-migration>
<step>OCA\OcSms\Migration\FixConversationReadStates</step>
</post-migration>
</repair-steps>
</info>
+24 -3
View File
@@ -22,9 +22,12 @@ use \OCA\OcSms\Controller\SmsController;
use \OCA\OcSms\Db\Sms;
use \OCA\OcSms\Db\SmsMapper;
use \OCA\OcSms\Db\ConversationStateMapper;
use \OCA\OcSms\Db\ConfigMapper;
use \OCA\OcSms\Migration\FixConversationReadStates;
class OcSmsApp extends App {
/**
@@ -41,8 +44,8 @@ class OcSmsApp extends App {
});
/**
* Database Layer
*/
* Database Layer
*/
$container->registerService('ConfigMapper', function (IContainer $c) use ($server) {
return new ConfigMapper(
$server->getDb(),
@@ -55,8 +58,15 @@ class OcSmsApp extends App {
return new Sms($server->getDb());
});
$container->registerService('ConversationStateMapper', function(IContainer $c) use ($server) {
return new ConversationStateMapper($server->getDb());
});
$container->registerService('SmsMapper', function(IContainer $c) use ($server) {
return new SmsMapper($server->getDb());
return new SmsMapper(
$server->getDb(),
$c->query('ConversationStateMapper')
);
});
/**
@@ -83,6 +93,7 @@ class OcSmsApp extends App {
$c->query('Request'),
$c->query('UserId'),
$c->query('SmsMapper'),
$c->query('ConversationStateMapper'),
$c->query('ConfigMapper'),
$server->getContactsManager(),
$server->getURLGenerator()
@@ -97,5 +108,15 @@ class OcSmsApp extends App {
$c->query('SmsMapper')
);
});
/**
* Migration services
*/
$container->registerService('OCA\OcSms\Migration\FixConversationReadStates', function ($c) {
return new FixConversationReadStates(
$c->query('ConversationStateMapper'),
$c->getServer()->getUserManager()
);
});
}
}