1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.user
21 
22 import org.make.api.user.PersistentCrmSynchroUserService.CrmSynchroUser
23 import org.make.core.technical.Pagination
24 import org.make.core.question.QuestionId
25 import org.make.core.reference.{Country, Language}
26 import org.make.core.user.{User, UserId, UserType}
27 
28 import java.time.{LocalDate, ZonedDateTime}
29 import scala.concurrent.Future
30 
31 trait PersistentCrmSynchroUserService {
32 
33   def findUsersForCrmSynchro(
34     optIn: Option[Boolean],
35     hardBounce: Option[Boolean],
36     offset: Pagination.Offset,
37     limit: Pagination.Limit
38   ): Future[Seq[CrmSynchroUser]]
39 
40 }
41 
42 object PersistentCrmSynchroUserService {
43   type CrmSynchroUser = MakeUser
44 
45   final case class MakeUser(
46     uuid: UserId,
47     email: String,
48     firstName: Option[String],
49     lastName: Option[String],
50     organisationName: Option[String],
51     postalCode: Option[String],
52     dateOfBirth: Option[LocalDate],
53     emailVerified: Boolean,
54     isHardBounce: Boolean,
55     optInNewsletter: Boolean,
56     createdAt: ZonedDateTime,
57     userType: UserType,
58     country: Country,
59     lastConnection: Option[ZonedDateTime],
60     registerQuestionId: Option[QuestionId],
61     crmCountry: Country,
62     crmLanguage: Language
63   ) {
64     def fullName: Option[String] = {
65       User.fullName(firstName, lastName, organisationName)
66     }
67   }
68 
69 }
70 
71 trait PersistentCrmSynchroUserServiceComponent {
72   def persistentCrmSynchroUserService: PersistentCrmSynchroUserService
73 }
Line Stmt Id Pos Tree Symbol Tests Code
65 30464 1990 - 2042 Apply org.make.core.user.User.fullName org.make.api.technical.crm.crmservicecomponenttest org.make.core.user.User.fullName(MakeUser.this.firstName, MakeUser.this.lastName, MakeUser.this.organisationName)
65 30458 2015 - 2023 Select org.make.api.user.PersistentCrmSynchroUserService.MakeUser.lastName org.make.api.technical.crm.crmservicecomponenttest MakeUser.this.lastName
65 30469 2004 - 2013 Select org.make.api.user.PersistentCrmSynchroUserService.MakeUser.firstName org.make.api.technical.crm.crmservicecomponenttest MakeUser.this.firstName
65 30472 2025 - 2041 Select org.make.api.user.PersistentCrmSynchroUserService.MakeUser.organisationName org.make.api.technical.crm.crmservicecomponenttest MakeUser.this.organisationName