Subversion Repositories SmartDukaan

Rev

Rev 3374 | Rev 3405 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3026 mandeep.dh 1
namespace java in.shop2020.crm
2
namespace py shop2020.thriftpy.crm
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
3026 mandeep.dh 6
enum TicketPriority {
7
    LOW = 0,
8
    HIGH = 1,
9
    MEDIUM = 2
10
}
11
 
12
enum TicketStatus {
13
    OPEN = 0,
14
    CLOSED = 1,
15
    REOPEN = 2
16
}
17
 
18
enum TicketCategory {
19
    RETURN_FORM = 1,
20
    ORDER_CANCELLATION = 2,
21
    DELIVERY_PROBLEM = 3,
22
    PAYMENT_STATUS = 4,
23
    ORDER_STATUS = 5,
24
    PRODUCT_REQUEST = 6,
25
    PRODUCT_QUESTION = 7,
26
    OTHER = 8
27
}
28
 
3106 mandeep.dh 29
enum ActivityType {
3269 mandeep.dh 30
    SEND_EMAIL_TO_CUSTOMER = 1,
3271 mandeep.dh 31
    RECEIVED_EMAIL_FROM_CUSTOMER = 2,
3269 mandeep.dh 32
    CALLED_CUSTOMER = 3,
3271 mandeep.dh 33
    RECEIVED_CALL_FROM_CUSTOMER = 4,
3269 mandeep.dh 34
    OTHER = 5
3106 mandeep.dh 35
}
36
 
3390 mandeep.dh 37
struct Agent {
38
    1:i64 id,
39
    2:string name,
40
    3:string emailId,
41
    4:optional i64 managerId,
42
    5:string password
43
}
44
 
3026 mandeep.dh 45
struct Ticket {
46
    1:i64 id,
3390 mandeep.dh 47
    2:optional i64 customerId,
48
    3:i64 openDate,
49
    4:optional i64 closeDate,
50
    5:optional string description,
51
    6:TicketPriority priority,
52
    7:TicketCategory category,
53
    8:TicketStatus status,
54
    9:optional i64 assigneeId,
55
   10:i64 creatorId,
56
   11:optional i64 orderId,
57
   12:optional string airwayBillNo,
58
   13:optional string productName,
59
 
60
   // used for un-registered users
61
   14:optional string customerMobileNumber,
62
   15:optional string customerEmailId,
63
   16:optional string customerName,
64
 
65
   // knitted/enriched object
66
   17:optional Agent assignee,
67
   18:optional Agent creator
3026 mandeep.dh 68
}
69
 
70
struct Activity {
71
    1:i64 id,
3168 mandeep.dh 72
    2:optional string description,
3106 mandeep.dh 73
    3:i64 creationTimestamp, // represents time at which this activity occurred
74
    4:ActivityType type,
3269 mandeep.dh 75
    5:optional i64 customerId, // used for registered users
3390 mandeep.dh 76
    6:i64 creatorId,
3026 mandeep.dh 77
 
3269 mandeep.dh 78
    // represents the numeric identifier for the emails sent to customers
79
    // These are archived in helper..useremailarchive or helper..useremail
3390 mandeep.dh 80
    7:optional i64 userEmailId,
3269 mandeep.dh 81
 
3106 mandeep.dh 82
    // ticket related fields to track changes on ticket fields
3390 mandeep.dh 83
    8:optional i64 ticketId,
84
    9:optional TicketPriority ticketPriority,
85
   10:optional i64 ticketAssigneeId,
86
   11:optional TicketStatus ticketStatus,
87
   12:optional TicketCategory ticketCategory,
88
   13:optional string ticketDescription,
89
 
90
   // Activities created as part of mails received from customers
91
   // have to be explicitly marked as read by agents in CRM.
92
   // This flag is set over such activities when any agent marks it as read!
93
   14:optional bool isRead
94
 
95
   // used for un-registered users
96
   15:optional string customerMobileNumber,
97
   16:optional string customerEmailId,
98
   17:optional string customerName,
99
 
100
   // knitted types for enriched objects
101
   18:optional Agent creator,
102
   19:optional Agent ticketAssignee
3026 mandeep.dh 103
}
104
 
3390 mandeep.dh 105
struct SearchFilter {
106
    1:optional i64 ticketId,
107
    2:optional i64 activityId,
108
    3:optional list<i64> ticketAssigneeIds,
109
    4:optional list<i64> activityCreatorIds,
110
    5:optional i64 agentId,
111
    6:optional i64 customerId,
112
    7:optional i64 startTimestamp,
113
    8:optional i64 endTimestamp,
114
    9:optional bool isActivityRead,
115
   10:optional string agentEmailId,
116
   11:optional string customerEmailId,
117
   12:optional string customerMobileNumber
3026 mandeep.dh 118
}
119
 
3374 rajveer 120
service CRMService extends GenericService.GenericService{
3026 mandeep.dh 121
    // Methods to read/write tickets from/in database
3390 mandeep.dh 122
    list<Ticket> getTickets(1:SearchFilter searchFilter);
3137 mandeep.dh 123
    list<Ticket> getUnassignedTickets();
3206 mandeep.dh 124
    void updateTicket(1:Ticket ticket, 2:Activity activity);
125
    i64 insertTicket(1:Ticket ticket, 2:Activity activity);
3026 mandeep.dh 126
 
127
    // Methods to read/write activities from/in database
3390 mandeep.dh 128
    list<Activity> getActivities(1:SearchFilter searchFilter);
3026 mandeep.dh 129
    void insertActivity(1:Activity activity);
3390 mandeep.dh 130
    void markAsRead(1:i64 activityId, 2:i64 agentId);
3026 mandeep.dh 131
 
132
    // Methods to read agent information
3390 mandeep.dh 133
    list<Agent> getAgents(1:SearchFilter searchFilter);
3087 mandeep.dh 134
    void updatePasswordForAgent(1:string agentEmailId, 2:string password);
135
 
136
    // Methods to read roles and permissions information
137
    list<string> getRoleNamesForAgent(1:string agentEmailId);
3106 mandeep.dh 138
    list<string> getPermissionsForRoleName(1:string roleName);
3339 mandeep.dh 139
 
140
    // Misc methods
141
    i64 getLastEmailProcessedTimestamp();
142
    void updateLastEmailProcessedTimestamp(1:i64 timestamp);
3026 mandeep.dh 143
}