1 /* |
1 /* |
2 * Copyright 2011 Tomas Zeman <tzeman@volny.cz> |
2 * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz> |
3 * |
3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. |
5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at |
6 * You may obtain a copy of the License at |
7 * |
7 * |
19 import fis.geo.model.GeoSchema |
19 import fis.geo.model.GeoSchema |
20 import net.liftweb.squerylrecord.RecordTypeMode._ |
20 import net.liftweb.squerylrecord.RecordTypeMode._ |
21 |
21 |
22 trait CrmSchema extends BaseSchema with GeoSchema { |
22 trait CrmSchema extends BaseSchema with GeoSchema { |
23 |
23 |
24 val contacts = entityTable[Contact]("contact") |
24 val contacts = table[Contact]("contact") |
25 |
25 |
|
26 /* |
26 val entityContacts = manyToManyRelation(entities, contacts). |
27 val entityContacts = manyToManyRelation(entities, contacts). |
27 via[EntityContact]((e, c, ec) => ( |
28 via[EntityContact]((e, c, ec) => ( |
28 e.id === ec.entityId, |
29 e.id === ec.entityId, |
29 c.id === ec.contactId |
30 c.id === ec.contactId |
30 )) |
31 )) |
31 |
32 |
32 entityContacts.leftForeignKeyDeclaration.unConstrainReference |
33 entityContacts.leftForeignKeyDeclaration.unConstrainReference |
33 |
34 |
34 val contactTypeToEntityContacts = oneToManyRelation(codeListItems, |
35 val contactTypeToEntityContacts = oneToManyRelation(codeListItems, |
35 entityContacts).via((cli, ec) => cli.id === ec.typeId) |
36 entityContacts).via((cli, ec) => cli.id === ec.typeId) |
|
37 */ |
36 |
38 |
37 val companies = entityTable[Company]("company") |
39 val companies = table[Company]("company") |
38 |
40 |
39 val companyToAddress = oneToManyRelation(addresses, companies). |
41 val companyToAddress = oneToManyRelation(addresses, companies). |
40 via((a, c) => c.addressId === a.id) |
42 via((a, c) => c.addressId === a.id) |
41 |
43 |
42 val companyToCorrespAddress = oneToManyRelation(addresses, companies). |
44 val companyToCorrespAddress = oneToManyRelation(addresses, companies). |