drop audit columns on client and group entities. update client api docs. update ddl and demo schemas.

This commit is contained in:
Keith Woodlock
2013-01-29 13:24:35 +00:00
parent 5f4e1103c2
commit e0036e8d2b
6 changed files with 173 additions and 106 deletions
+144 -67
View File
@@ -679,7 +679,6 @@ var jqxhr = $.ajax({
</div>
</div>
<a id="clients_template" name="clients_template" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
@@ -773,9 +772,10 @@ Request Body:
"joinedDate": "04 March 2009"
}
</code>
<code class="method-response">
{
"resourceId":23
<code class="method-response">{
"officeId": 1,
"clientId": 83,
"resourceId": 83
}
</code>
</div>
@@ -792,9 +792,10 @@ Request Body:
"joinedDate": "13 June 2006"
}
</code>
<code class="method-response">
{
"resourceId":26
<code class="method-response">{
"officeId": 1,
"clientId": 84,
"resourceId": 84
}
</code>
</div>
@@ -807,7 +808,7 @@ Request Body:
</div>
<div class="method-example">
<code class="method-declaration">PUT https://Domain Name/api/v1/clients/{clientId}</code>
<code class="method-request">PUT clients/23
<code class="method-request">PUT clients/83
Content-Type: application/json
Request Body:
{
@@ -817,7 +818,18 @@ Request Body:
"joinedDate": "09 June 2006"
}
</code>
<code class="method-response">{ "resourceId": 23}</code>
<code class="method-response">{
"officeId": 1,
"clientId": 83,
"resourceId": 83,
"changes": {
"externalId": "786444UUUYYH7",
"joinedDate": "09 June 2006",
"dateFormat": "dd MMMM yyyy",
"locale": "en"
}
}
</code>
</div>
</div>
@@ -838,13 +850,61 @@ Request Body:
<div class="method-example">
<code class="method-declaration">GET https://Domain Name/api/v1/clients/{clientId}/loans</code>
<code class="method-response">{
"anyLoanCount": 3,
"anyLoanCount": 9,
"pendingApprovalLoanCount": 4,
"pendingApprovalLoans": [
{
"id": 48,
"accountNo": "48",
"productId": 1,
"productName": "PORetailLoan",
"status": {
"id": 100,
"code": "loanStatusType.submitted.and.pending.approval",
"value": "Submitted and pending approval"
}
},
{
"id": 50,
"accountNo": "50",
"productId": 1,
"productName": "PORetailLoan",
"status": {
"id": 100,
"code": "loanStatusType.submitted.and.pending.approval",
"value": "Submitted and pending approval"
}
},
{
"id": 51,
"accountNo": "51",
"productId": 1,
"productName": "PORetailLoan",
"status": {
"id": 100,
"code": "loanStatusType.submitted.and.pending.approval",
"value": "Submitted and pending approval"
}
},
{
"id": 62,
"accountNo": "62",
"productId": 3,
"productName": "Further Loan Product",
"status": {
"id": 100,
"code": "loanStatusType.submitted.and.pending.approval",
"value": "Submitted and pending approval"
}
}
],
"activeLoanCount": 2,
"openLoans": [
{
"id": 22,
"id": 46,
"accountNo": "46",
"productId": 1,
"productName": "Agricultural Loan",
"productName": "PORetailLoan",
"status": {
"id": 300,
"code": "loanStatusType.active",
@@ -852,9 +912,10 @@ Request Body:
}
},
{
"id": 44,
"id": 60,
"accountNo": "60",
"productId": 1,
"productName": "Agricultural Loan",
"productName": "PORetailLoan",
"status": {
"id": 300,
"code": "loanStatusType.active",
@@ -862,17 +923,40 @@ Request Body:
}
}
],
"closedLoanCount": 1,
"closedLoanCount": 3,
"closedLoans": [
{
"id": 33,
"id": 22,
"accountNo": "22",
"productId": 1,
"productName": "Agricultural Loan",
"productName": "PORetailLoan",
"status": {
"id": 700,
"code": "loanStatusType.overpaid",
"value": "Overpaid"
}
},
{
"id": 33,
"accountNo": "33",
"productId": 1,
"productName": "PORetailLoan",
"status": {
"id": 601,
"code": "loanStatusType.closed.written.off",
"value": "Closed (written off)"
}
},
{
"id": 44,
"accountNo": "44",
"productId": 1,
"productName": "PORetailLoan",
"status": {
"id": 600,
"code": "loanStatusType.closed.obligations.met",
"value": "Closed (obligations met)"
}
}
]
}
@@ -880,7 +964,6 @@ Request Body:
</div>
</div>
<a id="clients_notes" name="clients_notes" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
@@ -895,37 +978,24 @@ Request Body:
</div>
<div class="method-example">
<code class="method-declaration">GET https://Domain Name/api/v1/clients/{clientId}/notes</code>
<code class="method-response">[ {
"id" : 20,
"clientId" : 2,
"noteType" : {
"id" : 100,
"code" : "noteType.client",
"value" : "Client note"
},
"note" : "This is an extra note!",
"createdById" : 2,
"createdByUsername" : "super1",
"createdOn" : 1335066625000,
"updatedById" : 2,
"updatedByUsername" : "super1",
"updatedOn" : 1335066625000
}, {
"id" : 16,
"clientId" : 2,
"noteType" : {
"id" : 100,
"code" : "noteType.client",
"value" : "Client note"
},
"note" : "loan only 1/2 amount expected\r\nyes",
"createdById" : 2,
"createdByUsername" : "super1",
"createdOn" : 1334726104000,
"updatedById" : 2,
"updatedByUsername" : "super1",
"updatedOn" : 1335137893000
} ]
<code class="method-response">[
{
"id": 2,
"clientId": 1,
"noteType": {
"id": 100,
"code": "noteType.client",
"value": "Client note"
},
"note": "First note\r\n\r\nedited",
"createdById": 1,
"createdByUsername": "mifos",
"createdOn": 1342498505000,
"updatedById": 1,
"updatedByUsername": "mifos",
"updatedOn": 1342498517000
}
]
</code>
</div>
</div>
@@ -945,7 +1015,9 @@ Request Body:
}
</code>
<code class="method-response">{
"resourceId": 40
"officeId": 1,
"clientId": 1,
"resourceId": 76
}
</code>
</div>
@@ -956,27 +1028,27 @@ Request Body:
<div class="method-description">
<h4>Retrieve a Client Note</h4>
<p>Example Requests: </p>
<div class=apiClick>clients/2/notes/20</div>
<div class=apiClick>clients/1/notes/76</div>
<br><br>
<div class=apiClick>clients/2/notes/20?fields=note,createdOn,createdByUsername</div>
<div class=apiClick>clients/1/notes/76?fields=note,createdOn,createdByUsername</div>
</div>
<div class="method-example">
<code class="method-declaration">GET https://Domain Name/api/v1/clients/{clientId}/notes/{noteId}</code>
<code class="method-response">{
"id" : 20,
"clientId" : 2,
"noteType" : {
"id" : 100,
"code" : "noteType.client",
"value" : "Client note"
"id": 76,
"clientId": 1,
"noteType": {
"id": 100,
"code": "noteType.client",
"value": "Client note"
},
"note" : "This is an extra note!",
"createdById" : 2,
"createdByUsername" : "super1",
"createdOn" : 1335066625000,
"updatedById" : 2,
"updatedByUsername" : "super1",
"updatedOn" : 1335066625000
"note": "a note about the client",
"createdById": 1,
"createdByUsername": "mifos",
"createdOn": 1359463135000,
"updatedById": 1,
"updatedByUsername": "mifos",
"updatedOn": 1359463135000
}
</code>
</div>
@@ -989,7 +1061,7 @@ Request Body:
</div>
<div class="method-example">
<code class="method-declaration">PUT https://Domain Name/api/v1/clients/{clientId}/notes/{noteId}</code>
<code class="method-request">PUT clients/2/notes/20
<code class="method-request">PUT clients/1/notes/76
Content-Type: application/json
Request Body:
{
@@ -997,7 +1069,12 @@ Request Body:
}
</code>
<code class="method-response">{
"resourceId": 20
"officeId": 1,
"clientId": 1,
"resourceId": 76,
"changes": {
"note": "and here the note is updated nicely."
}
}
</code>
</div>
@@ -323,18 +323,10 @@ CREATE TABLE `m_group` (
`name` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKJPWG000000000003` (`createdby_id`),
KEY `FKJPWG000000000004` (`lastmodifiedby_id`),
KEY `office_id` (`office_id`),
CONSTRAINT `FKJPWG000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKJPWG000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `m_group_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -350,19 +342,11 @@ CREATE TABLE `m_client` (
`display_name` varchar(100) NOT NULL,
`image_key` varchar(500) DEFAULT NULL,
`joined_date` date DEFAULT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `account_no_UNIQUE` (`account_no`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKCE00CAB3E0DD567A` (`office_id`),
KEY `FKAUD0000000000001` (`createdby_id`),
KEY `FKAUD0000000000002` (`lastmodifiedby_id`),
CONSTRAINT `FKAUD0000000000001` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKAUD0000000000002` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKCE00CAB3E0DD567A` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=utf8;
@@ -2058,4 +2058,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-01-29 11:37:27
-- Dump completed on 2013-01-29 12:54:03
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
ALTER TABLE `m_client`
DROP FOREIGN KEY `FKAUD0000000000002` ,
DROP FOREIGN KEY `FKAUD0000000000001`;
ALTER TABLE `m_client`
DROP COLUMN `lastmodifiedby_id` ,
DROP COLUMN `lastmodified_date` ,
DROP COLUMN `created_date` ,
DROP COLUMN `createdby_id` ,
DROP INDEX `FKAUD0000000000002` ,
DROP INDEX `FKAUD0000000000001`;
ALTER TABLE `m_group`
DROP FOREIGN KEY `FKJPWG000000000004` ,
DROP FOREIGN KEY `FKJPWG000000000003`;
ALTER TABLE `m_group`
DROP COLUMN `lastmodifiedby_id` ,
DROP COLUMN `lastmodified_date` ,
DROP COLUMN `created_date` ,
DROP COLUMN `createdby_id` ,
DROP INDEX `FKJPWG000000000004` ,
DROP INDEX `FKJPWG000000000003`;
@@ -12,15 +12,14 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
import org.mifosplatform.organisation.office.domain.Office;
import org.mifosplatform.portfolio.client.domain.Client;
import org.mifosplatform.portfolio.group.command.GroupCommand;
import org.mifosplatform.useradministration.domain.AppUser;
import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity
@Table(name = "m_group")
public class Group extends AbstractAuditableCustom<AppUser, Long> {
public class Group extends AbstractPersistable<Long> {
@SuppressWarnings("unused")
@ManyToOne