Browse Source

small fixes

alexlcdee 8 years ago
parent
commit
f6712735aa
5 changed files with 7 additions and 7 deletions
  1. 0 1
      build/.env
  2. 1 1
      src/ChatApi.ts
  3. 2 2
      src/Client.ts
  4. 2 1
      src/Conversation.ts
  5. 2 2
      src/main.ts

+ 0 - 1
build/.env

@@ -1,4 +1,3 @@
-MODE=prod
 HOST=127.0.0.1
 PORT=5000
 API_HOST=galapsy.ru

+ 1 - 1
src/ChatApi.ts

@@ -52,7 +52,7 @@ export namespace ChatApi {
                     this.logger.error(err.stack);
                     this.logger.error('DATA: '+content);
                     response.writeHead(500, {'Content-type': 'text/plain'});
-                    response.end(err.message + err.stack);
+                    response.end(err.message + "\n" + err.stack + "\nData: "+ content);
                 }
             });
         }

+ 2 - 2
src/Client.ts

@@ -11,7 +11,7 @@ export namespace Clients {
         photo: string;
         role: string;
         payedTime: string;
-        timeToPay: number;
+        timeToPay: string;
         coefficient: string;
     }
 
@@ -160,7 +160,7 @@ export namespace Clients {
             this.clientPhoto = data.photo;
             this.clientName = data.name;
             this.payedTime = parseInt(data.payedTime);
-            this.timeToPay = data.timeToPay;
+            this.timeToPay = parseInt(data.timeToPay);
             this._coefficient = parseInt(data.coefficient) ? parseInt(data.coefficient) : 1;
             setInterval(this.releaseQueue.bind(this), 10000);
         }

+ 2 - 1
src/Conversation.ts

@@ -243,7 +243,8 @@ export module Conversations {
                 value: this.initiator.payedTime
             });
             this.apiConnector.execute('/user', {
-                action: 'updatetime', id: this.recipient.id,
+                action: 'updatetime',
+                id: this.recipient.id,
                 value: this.recipient.payedTime
             });
             this.initiator.send('chat-conversation-stop', {id: this.id});

+ 2 - 2
src/main.ts

@@ -9,7 +9,7 @@ import * as HTTP from "http";
 
 (function main() {
     require('dotenv').config({path: __dirname + "/.env"});
-    let logger = new Log.ConsoleLogger(Interfaces.AppMode.create(process.env.MODE));
+    let logger = new Log.ConsoleLogger(Interfaces.AppMode.create(process.env.NODE_ENV || 'prod'));
     try {
         let apiConnector = new Api.DefaultConnector(process.env.API_HOST, process.env.API_PORT, process.env.API_ENDPOINT_PREFIX, logger);
         let clientsManager = new Clients.DefaultManager(apiConnector, logger);
@@ -23,7 +23,7 @@ import * as HTTP from "http";
         new App(apiConnector, clientsManager, conversationsManager, logger, apiServer, {
             port: process.env.PORT,
             host: process.env.HOST,
-            mode: Interfaces.AppMode.create(process.env.MODE)
+            mode: Interfaces.AppMode.create(process.env.NODE_ENV || 'prod')
         });
 
     } catch (e) {