Subversion Repositories SmartDukaan

Rev

Rev 2356 | Rev 2455 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

namespace java in.shop2020.utils
namespace py shop2020.thriftpy.utils

/**
Helper service
created by @ashish
**/

struct Mail{
        1:list<string> to,
        2:string subject,
        3:string data,
        4:string sender,
        5:list<string> attachments,
        6:string password
}

struct TextMessage{
        1:string number,
        2:string message,
        3:i64 dispatchTime,
        4:i64 deliveryTime
}

exception HelperServiceException{
        1:i64 id,
        2:string message
}

struct Message{
        1:i64 id,
        2:string message
}

struct DashboardUser{
        1:string username,
        2:string password,
        3:i64 warehouseId,
        4:bool admin
}

struct LogisticsUser{
        1:string username,
        2:i64 providerId
}

struct StatisticsUser{
        1:string username
}

struct CatalogDashboardUser{
        1:string username,
        2:string password,
        3:i64 role
}

struct UserEmail{
        1:i64 id,
        2:string emailTo,
        3:string emailFrom,
        4:string subject,
        5:string body,
        6:string source,
        7:string emailType,
        8:bool status,
        9:i64 timestamp
}

struct ReportUser{
        1:string username,
        2:i64 role
}

struct Report{
        1:i64 id,
        2:string description,
        3:string controller
}

service HelperService{
        /**
        * For closing the open session in sqlalchemy
        */
        void closeSession(),
        
        void saveUserEmailForSending(1:string emailTo, 2:string emailFrom, 3:string subject, 4:string body, 5:string source, 6:string emailType) throws (1:HelperServiceException se),
        list<UserEmail> getEmailsToBeSent(1:string emailType) throws (1:HelperServiceException se),
        void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
        
        void sendMail(1:Mail mail) throws (1:HelperServiceException se),
        void sendText(1:TextMessage message) throws (1:HelperServiceException se),
        
        void addMessage(1:Message message) throws (1:HelperServiceException se),
        void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
        Message getMessage(1:i64 id) throws (1:HelperServiceException se),
        Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
        
        //authenticate dashboard users
        bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
        bool deleteUser(1:string username) throws (1:HelperServiceException se),
        
        /**
         Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
         The loggedOn timestamp for the dashboard user is updated .
        */
        DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
        
        /**
        Update the password of the dashboard user. Currently, there is no place where this method is called.
        */
        bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
        
        /**
         Returns the LogisticsUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
        
        /**
         Returns the StatisticsUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
        
        /**
         Returns the ReportUser struct associated with the given username and password if they match.
         Throws an exception otherwise.
        */
        ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
        
        /**
        Returns list of reports which are configured for the given role. 
        */
        list<Report> getReports(1:i64 role),
        
        /**
         Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
         Throws an exception otherwise.
        */
        CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password, 3:i64 role) throws(1:HelperServiceException hse),
}