src/main/scala/fis/crm/model/CrmSchema.scala
changeset 10 fc7b6a99deb4
parent 8 828565e7f571
child 23 16066379860c
--- a/src/main/scala/fis/crm/model/CrmSchema.scala	Fri Feb 10 09:53:05 2012 +0100
+++ b/src/main/scala/fis/crm/model/CrmSchema.scala	Fri Feb 10 09:53:06 2012 +0100
@@ -16,9 +16,10 @@
 package fis.crm.model
 
 import fis.base.model.BaseSchema
+import fis.geo.model.GeoSchema
 import net.liftweb.squerylrecord.RecordTypeMode._
 
-trait CrmSchema extends BaseSchema {
+trait CrmSchema extends BaseSchema with GeoSchema {
 
   val contacts = entityTable[Contact]("contact")
 
@@ -32,6 +33,19 @@
 
   val contactTypeToEntityContacts = oneToManyRelation(codeListItems,
     entityContacts).via((cli, ec) => cli.id === ec.typeId)
+
+  val companies = entityTable[Company]("company")
+
+  val companyToAddress = oneToManyRelation(addresses, companies).
+    via((a, c) => c.addressId === a.id)
+
+  val companyToCorrespAddress = oneToManyRelation(addresses, companies).
+    via((a, c) => c.correspAddressId === a.id)
+
+  val bankAccounts = table[BankAccount]("bank_account")
+
+  val companyToBankAccounts = oneToManyRelation(companies, bankAccounts).
+    via((c, a) => c.id === a.companyId)
 }
 
 object CrmSchema extends CrmSchema