Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 56 lines 1.7 kB view raw
1// Types for tables in the user stats service's schema. 2// THESE SHOULD NOT BE USED OUTSIDE OF THIS SERVICE. 3 4export type UserStatisticsServiceWarehouse = { 5 'USER_STATISTICS_SERVICE.SUBMISSION_STATS': SubmissionStats; 6 'USER_STATISTICS_SERVICE.LIFETIME_ACTION_STATS': LifetimeActionStats; 7 'USER_STATISTICS_SERVICE.USER_SCORES': UserScores; 8}; 9 10export type UserStatisticsServicePg = { 11 'user_statistics_service.user_scores': { 12 org_id: string; 13 user_id: string; 14 user_type_id: string; 15 score: number; 16 }; 17}; 18 19export type LifetimeActionStats = { 20 ORG_ID: string; 21 USER_ID: string; 22 USER_TYPE_ID: string; 23 ACTION_ID: string; 24 POLICY_ID: string | null; 25 ACTOR_ID: string | null; 26 ITEM_SUBMISSION_IDS: string[]; 27 // TODO: technically count is nullable in the db (it's just never null); 28 // we should migrate the db. 29 COUNT: number; 30}; 31 32export type SubmissionStats = { 33 ORG_ID: string; 34 USER_ID: string; 35 // This is the item type of the user in question 36 USER_TYPE_ID: string; 37 // This is the item type that the user has submitted 38 ITEM_TYPE_ID: string; 39 NUM_SUBMISSIONS: string; 40 // NB: these are actually warehouse Date instances (driver-specific). The 41 // warehouse driver may use a custom class that roughly extends Date, but 42 // adds a custom toString() that changes (breaks) the date's default JSON 43 // representation. 44 // TODO: convert these globally to Dates at the Kysely level, so we don't 45 // have to deal with this nonsense in our code. 46 TS_START_INCLUSIVE: Date; 47 TS_END_EXCLUSIVE: Date; 48}; 49 50export type UserScores = { 51 ORG_ID: string; 52 USER_ID: string; 53 USER_TYPE_ID: string; 54 SCORE: number; 55 SCORE_DATE: Date; 56};