File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import CampaignContact from "./campaign-contact";
1111import InteractionStep from "./interaction-step" ;
1212import QuestionResponse from "./question-response" ;
1313import OptOut from "./opt-out" ;
14+ import OptIn from "./opt-in" ;
1415import JobRequest from "./job-request" ;
1516import Invite from "./invite" ;
1617import CannedResponse from "./canned-response" ;
@@ -64,6 +65,7 @@ const tableList = [
6465 "log" ,
6566 "message" ,
6667 "opt_out" , // good candidate
68+ "opt_in" ,
6769 "pending_message_part" ,
6870 "question_response" ,
6971 "tag" ,
@@ -131,6 +133,7 @@ const createLoaders = () => ({
131133 jobRequest : createLoader ( JobRequest ) ,
132134 message : createLoader ( Message ) ,
133135 optOut : createLoader ( OptOut ) ,
136+ optIn : createLoader ( OptIn ) ,
134137 pendingMessagePart : createLoader ( PendingMessagePart ) ,
135138 questionResponse : createLoader ( QuestionResponse ) ,
136139 userCell : createLoader ( UserCell ) ,
@@ -165,6 +168,7 @@ export {
165168 JobRequest ,
166169 Message ,
167170 OptOut ,
171+ OptIn ,
168172 Organization ,
169173 PendingMessagePart ,
170174 CannedResponse ,
Original file line number Diff line number Diff line change 1+ import thinky from "./thinky" ;
2+ const type = thinky . type ;
3+ import { optionalString , requiredString , timestamp } from "./custom-types" ;
4+
5+ import Organization from "./organization" ;
6+ import Assignment from "./assignment" ;
7+
8+ const OptIn = thinky . createModel (
9+ "opt_in" ,
10+ type
11+ . object ( )
12+ . schema ( {
13+ id : type . string ( ) ,
14+ cell : requiredString ( ) ,
15+ assignment_id : optionalString ( ) ,
16+ organization_id : requiredString ( ) ,
17+ reason_code : optionalString ( ) ,
18+ created_at : timestamp ( )
19+ } )
20+ . allowExtra ( false ) ,
21+ { noAutoCreation : true , dependencies : [ Organization , Assignment ] }
22+ ) ;
23+
24+ OptIn . ensureIndex ( "cell" ) ;
25+ OptIn . ensureIndex ( "assignment_id" ) ;
26+ OptIn . ensureIndex ( "organization_id" ) ;
27+
28+ export default OptIn ;
You can’t perform that action at this time.
0 commit comments