Creating Your Own Activity Registration in GAE / P

I would like to register user activity in my application for presentation to users, as well as for administrative purposes. My clients are companies, so there are three levels at which I can represent activities:

  • Single user activity
  • Activities of all users of the company
  • All activities

To complete the logging, I would create a model for storing log entries. I see several ways to do this.

At first, I could store each registered activity in my own entity and then query as needed:

class Activity(ndb.Model):
    activity = ndb.StringProperty()
    user_id = ndb.StringProperty()
    company_id = ndb.StringProperty()

Secondly, I could store all user activity in one object:

class UserActivity(ndb.Model):
    activity = ndb.StringProperty(repeated=True) # Note this is now a list
    company_id = ndb.StringProperty()

Thirdly, I could store all the activities of the company in one object:

class CompanyActivity(ndb.Model):
    activity = ndb.StringProperty(repeated=True) # Would store user_id here somehow

? , , , , .

( )? ?

+4
1

, : , UserActivity CompanyActivity, , . 1- , , , .

, , : , , , :

  • get()/put() , .
  • (~ 1 , . Limits),

3- , , .

1- , , :

  • - , - ( ).
  • ( /, Activity - ), ( ).
+2

Source: https://habr.com/ru/post/1695528/


All Articles