trex-model 1.4.4__tar.gz → 1.4.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of trex-model might be problematic. Click here for more details.

Files changed (61) hide show
  1. {trex-model-1.4.4 → trex-model-1.4.5}/PKG-INFO +1 -1
  2. {trex-model-1.4.4 → trex-model-1.4.5}/setup.py +1 -1
  3. {trex-model-1.4.4 → trex-model-1.4.5}/trex_model.egg-info/PKG-INFO +1 -1
  4. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/product_models.py +7 -6
  5. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/user_models.py +21 -8
  6. {trex-model-1.4.4 → trex-model-1.4.5}/LICENSE +0 -0
  7. {trex-model-1.4.4 → trex-model-1.4.5}/MANIFEST.in +0 -0
  8. {trex-model-1.4.4 → trex-model-1.4.5}/README.md +0 -0
  9. {trex-model-1.4.4 → trex-model-1.4.5}/setup.cfg +0 -0
  10. {trex-model-1.4.4 → trex-model-1.4.5}/trex_model.egg-info/SOURCES.txt +0 -0
  11. {trex-model-1.4.4 → trex-model-1.4.5}/trex_model.egg-info/dependency_links.txt +0 -0
  12. {trex-model-1.4.4 → trex-model-1.4.5}/trex_model.egg-info/requires.txt +0 -0
  13. {trex-model-1.4.4 → trex-model-1.4.5}/trex_model.egg-info/top_level.txt +0 -0
  14. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/__init__.py +0 -0
  15. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/conf.py +0 -0
  16. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/__init__.py +0 -0
  17. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/__init__.py +0 -0
  18. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/admin_models.py +0 -0
  19. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/analytic_models.py +0 -0
  20. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/app_models.py +0 -0
  21. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/coporate_models.py +0 -0
  22. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/customer_model_helpers.py +0 -0
  23. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/customer_models.py +0 -0
  24. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/fb_subsriber_models.py +0 -0
  25. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/import_models.py +0 -0
  26. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/inventory_model.py +0 -0
  27. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/loyalty_models.py +0 -0
  28. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/lucky_draw_models.py +0 -0
  29. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/marketing_models.py +0 -0
  30. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/membership_models.py +0 -0
  31. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/merchant_models.py +0 -0
  32. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/message_model_helper.py +0 -0
  33. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/message_models.py +0 -0
  34. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/model_decorators.py +0 -0
  35. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/ndb_models.py +0 -0
  36. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/pos_models.py +0 -0
  37. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/prepaid_models.py +0 -0
  38. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/program_models.py +0 -0
  39. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/rating_models.py +0 -0
  40. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/recruit_models.py +0 -0
  41. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/redeem_models.py +0 -0
  42. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/redemption_catalogue_models.py +0 -0
  43. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/referral_program_model.py +0 -0
  44. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/reward_model_helpers.py +0 -0
  45. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/reward_models.py +0 -0
  46. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/spending_base_program_model.py +0 -0
  47. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/system_models.py +0 -0
  48. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/task_models.py +0 -0
  49. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/test_models.py +0 -0
  50. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/transaction_models.py +0 -0
  51. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/datastore/voucher_models.py +0 -0
  52. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/merchant_helpers.py +0 -0
  53. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/model_decorator.py +0 -0
  54. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/models/prepaid_helpers.py +0 -0
  55. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/pos_conf.py +0 -0
  56. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/program_conf.py +0 -0
  57. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/utils/__init__.py +0 -0
  58. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/utils/gcloud/__init__.py +0 -0
  59. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/utils/gcloud/datastore_util.py +0 -0
  60. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/utils/model/__init__.py +0 -0
  61. {trex-model-1.4.4 → trex-model-1.4.5}/trexmodel/utils/model/model_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trex-model
3
- Version: 1.4.4
3
+ Version: 1.4.5
4
4
  Summary: TRex database module package
5
5
  Home-page: https://bitbucket.org/lokjac/trex-model
6
6
  Author: Jack Lok
@@ -3,7 +3,7 @@ with open("README.md", "r") as fh:
3
3
  long_description = fh.read()
4
4
  setuptools.setup(
5
5
  name='trex-model',
6
- version='1.4.4',
6
+ version='1.4.5',
7
7
  author="Jack Lok",
8
8
  author_email="sglok77@gmail.com",
9
9
  description="TRex database module package",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trex-model
3
- Version: 1.4.4
3
+ Version: 1.4.5
4
4
  Summary: TRex database module package
5
5
  Home-page: https://bitbucket.org/lokjac/trex-model
6
6
  Author: Jack Lok
@@ -382,7 +382,7 @@ class Product(ProductBase, FullTextSearchable):
382
382
  product_sku = ndb.StringProperty(required=True)
383
383
  product_name = ndb.StringProperty(required=True)
384
384
  product_desc = ndb.StringProperty(required=False)
385
- category_key = ndb.StringProperty(required=False)
385
+ category_key = ndb.StringProperty(required=False)
386
386
 
387
387
  barcode = ndb.StringProperty(required=False)
388
388
 
@@ -408,7 +408,8 @@ class Product(ProductBase, FullTextSearchable):
408
408
 
409
409
  fulltextsearch_field_name = 'product_name'
410
410
 
411
- dict_properties = ['product_sku', 'product_name', 'category_key', 'price', 'cost', 'product_desc', 'barcode', 'pos_settings', 'tax_details', 'product_modifier']
411
+ dict_properties = ['product_sku', 'product_name', 'category_key', 'price', 'cost',
412
+ 'product_desc', 'barcode', 'pos_settings', 'tax_details', 'product_modifier']
412
413
 
413
414
  @property
414
415
  def product_default_image(self):
@@ -434,6 +435,7 @@ class Product(ProductBase, FullTextSearchable):
434
435
  'label' : self.product_name,
435
436
  'desc' : self.product_desc,
436
437
  'price' : self.price,
438
+ 'category_key' : self.category_key,
437
439
  'barcode' : self.barcode,
438
440
  'modifiers' : modifier_setting_list_for_pos,
439
441
  'representation_on_pos' : self.pos_settings,
@@ -780,10 +782,9 @@ class ProductCatalogue(ProductBase):
780
782
  return total_count
781
783
 
782
784
  def publish(self):
783
- if self.is_publish == False:
784
- self.published_menu_settings = self.setting_details_for_pos
785
- self.is_publish = True
786
- self.put()
785
+ self.published_menu_settings = self.setting_details_for_pos
786
+ self.is_publish = True
787
+ self.put()
787
788
 
788
789
  def unpublish(self):
789
790
  self.is_publish = False
@@ -6,7 +6,7 @@ Created on 10 Apr 2020
6
6
  from google.cloud import ndb
7
7
  from trexmodel.models.datastore.ndb_models import BaseNModel, DictModel
8
8
  from trexlib.utils.string_util import random_number, random_string,\
9
- is_empty
9
+ is_empty, is_not_empty
10
10
  from flask_login import UserMixin
11
11
  import logging
12
12
  from trexlib.utils.security_util import generate_user_id, hash_password
@@ -37,14 +37,14 @@ class UserMin(BaseNModel, DictModel, UserMixin):
37
37
 
38
38
  locked = ndb.BooleanProperty(required=False, default=False)
39
39
  lock_expiry_datetime = ndb.DateTimeProperty(required=False)
40
- active = ndb.BooleanProperty(required=True, default=True)
40
+ active = ndb.BooleanProperty(required=True, default=True)
41
41
  try_count = ndb.IntegerProperty(required=False)
42
42
  demo_account = ndb.BooleanProperty(required=False, default=False)
43
43
  deleted = ndb.BooleanProperty(required=False, default=False)
44
+ signin_device_session = ndb.JsonProperty()
44
45
 
45
46
 
46
-
47
- dict_properties = ['user_id', 'name', 'email', 'gravatar_url', 'active', 'locked', 'lock_expiry_datetime']
47
+ dict_properties = ['user_id', 'name', 'email', 'signin_device_session', 'gravatar_url', 'active', 'locked', 'lock_expiry_datetime']
48
48
 
49
49
  @classmethod
50
50
  #@cache.memoize(timeout=60)
@@ -63,6 +63,18 @@ class UserMin(BaseNModel, DictModel, UserMixin):
63
63
  def is_admin_user(self):
64
64
  return False
65
65
 
66
+ @property
67
+ def signin_device_id(self):
68
+ if is_not_empty(self.signin_device_session):
69
+ return self.signin_device_session.get('device_id')
70
+
71
+ @property
72
+ def signin_expiry_datetime(self):
73
+ if is_not_empty(self.signin_device_session):
74
+ expiry_datetime_str = self.signin_device_session.get('expiry_datetime')
75
+ if is_not_empty(expiry_datetime_str):
76
+ return datetime.strptime(expiry_datetime_str, '%d-%m-%Y %H:%M:%S')
77
+
66
78
  def is_valid_password(self, checking_password):
67
79
  hashed_signin_password = hash_password(self.user_id, checking_password)
68
80
 
@@ -266,11 +278,11 @@ class UserBase(UserMin):
266
278
 
267
279
  if is_email_verified==False:
268
280
  created_user.email_vc = random_number(6)
269
- created_user.email_vc_expiry_datetime = datetime.now() + timedelta(minutes=10)
281
+ created_user.email_vc_expiry_datetime = datetime.utcnow()() + timedelta(minutes=10)
270
282
 
271
283
  if is_mobile_phone_verified==False:
272
284
  created_user.mobile_phone_vc = random_number(6)
273
- created_user.mobile_phone_vc_expiry_datetime = datetime.now() + timedelta(minutes=10)
285
+ created_user.mobile_phone_vc_expiry_datetime = datetime.utcnow() + timedelta(minutes=10)
274
286
 
275
287
  created_user.put()
276
288
 
@@ -379,7 +391,8 @@ class User(UserBase):
379
391
  'mobile_phone', 'email', 'password', 'name', 'birth_date', 'gender',
380
392
  'reference_code', 'country', 'state', 'city', 'postcode',
381
393
  'address', 'redeem_pin', 'new_message_count', 'status',
382
- 'device_details',
394
+ 'device_details', 'signin_device_session', 'referral_code',
395
+ 'last_login_datetime',
383
396
  ]
384
397
 
385
398
  #unique_attributes = 'email,username'
@@ -387,7 +400,7 @@ class User(UserBase):
387
400
  audit_properties = [
388
401
  'mobile_phone', 'email', 'password', 'name', 'birth_date', 'gender',
389
402
  'reference_code', 'country', 'state', 'city', 'postcode',
390
- 'address', 'redeem_pin', 'status', 'device_details',
403
+ 'address', 'redeem_pin', 'status', 'device_details',
391
404
 
392
405
  ]
393
406
 
File without changes
File without changes
File without changes
File without changes
File without changes