diff --git a/.gitignore b/.gitignore index 3083301..f618e1d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ /.vscode /.coveralls.yml *.tsbuildinfo -.DS_Store \ No newline at end of file +.DS_Store +.cursor \ No newline at end of file diff --git a/package.json b/package.json index 4632319..9ebd3c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@beincom/dto", - "version": "4.6.1", + "version": "5.0.0", "description": "Share dto for all projects of Beincom", "main": "./dist/index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index bd497d8..f4af037 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,5 +3,4 @@ export * from './invitation.dto'; export * from './user-id.value-object'; export * from './user.dto'; export * from './group.dto'; -export * from './shared-cache'; -export * from './subscription.dto' +export * from './subscription.dto'; diff --git a/src/shared-cache/index.ts b/src/shared-cache/index.ts deleted file mode 100644 index a5f7177..0000000 --- a/src/shared-cache/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './shared-group-cache'; -export * from './shared-user-cache'; -export * from './shared-notification-cache'; -export * from './shared-mission-cache'; diff --git a/src/shared-cache/shared-group-cache.ts b/src/shared-cache/shared-group-cache.ts deleted file mode 100644 index 63ade3b..0000000 --- a/src/shared-cache/shared-group-cache.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { CACHE_KEYS } from '@beincom/constants'; - -/** - * @deprecated Move to @beincom/constants@5.18.1 - */ -export class SharedGroupCacheKey { - private static PREFIX = 'group'; - private static hashTag = '{1}'; - - public static groupById(groupId: string): string { - return [SharedGroupCacheKey.PREFIX, SharedGroupCacheKey.hashTag, 'shared_group', groupId].join( - ':', - ); - } - - public static joinedGroupsOfUser(userId: string): string { - return [ - SharedGroupCacheKey.PREFIX, - SharedGroupCacheKey.hashTag, - CACHE_KEYS.JOINED_GROUPS, - userId, - ].join(':'); - } - - public static communityPermissionsOfUser(userId: string): string { - return [ - SharedGroupCacheKey.PREFIX, - SharedGroupCacheKey.hashTag, - CACHE_KEYS.COMMUNITY_PERMISSION, - userId, - ].join(':'); - } - - public static groupPermissionsOfUser(userId: string): string { - return [ - SharedGroupCacheKey.PREFIX, - SharedGroupCacheKey.hashTag, - CACHE_KEYS.GROUP_PERMISSION, - userId, - ].join(':'); - } - - public static showingBadgeOfUser(userId: string): string { - return [ - SharedGroupCacheKey.PREFIX, - SharedGroupCacheKey.hashTag, - CACHE_KEYS.SHOWING_BADGES, - userId, - ].join(':'); - } - - public static bannedTargetsOfUser(userId: string): string { - return [ - SharedGroupCacheKey.PREFIX, - SharedGroupCacheKey.hashTag, - CACHE_KEYS.BANNED_TARGETS_OF_USER, - userId, - ].join(':'); - } -} diff --git a/src/shared-cache/shared-mission-cache.ts b/src/shared-cache/shared-mission-cache.ts deleted file mode 100644 index 342a705..0000000 --- a/src/shared-cache/shared-mission-cache.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { CACHE_KEYS } from '@beincom/constants'; - -/** - * @deprecated Move to @beincom/constants@5.18.1 - */ -export class SharedMissionCacheKey { - private static PREFIX = 'mission'; - private static hashTag = '{1}'; - - public static getJackpotAchieved(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_ACHIEVED, - ].join(':'); - } - - public static getJackpotMedalConversionRate(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_MEDAL_CONVERSION_RATE, - ].join(':'); - } - - public static getJackpotSegments(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_SEGMENTS, - ].join(':'); - } - - public static getJackpotActivities(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_ACTIVITIES, - ].join(':'); - } - - public static getRateLimiter(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.RATE_LIMIT, - ].join(':'); - } - - public static getJackpotNRU(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_NRU, - ].join(':'); - } - - public static getJackpotRef(): string { - return [ - SharedMissionCacheKey.PREFIX, - SharedMissionCacheKey.hashTag, - CACHE_KEYS.MISSION.JACKPOT_REF, - ].join(':'); - } -} diff --git a/src/shared-cache/shared-notification-cache.ts b/src/shared-cache/shared-notification-cache.ts deleted file mode 100644 index f90de83..0000000 --- a/src/shared-cache/shared-notification-cache.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CACHE_KEYS } from '@beincom/constants'; - -/** - * @deprecated Move to @beincom/constants@5.18.1 - */ -export class SharedNotificationCacheKey { - static PREFIX = 'notification'; - - public static getUserOnlineKey(): string { - return [SharedNotificationCacheKey.PREFIX, CACHE_KEYS.USER_ONLINE].join(':'); - } -} diff --git a/src/shared-cache/shared-user-cache.ts b/src/shared-cache/shared-user-cache.ts deleted file mode 100644 index 1e16dee..0000000 --- a/src/shared-cache/shared-user-cache.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { CACHE_KEYS } from '@beincom/constants'; - -/** - * @deprecated Move to @beincom/constants@5.18.1 - */ -export class SharedUserCacheKey { - private static PREFIX = 'user'; - private static hashTag = '{1}'; - - public static usernameById(userId: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.USERNAME, - userId, - ].join(':'); - } - - public static profileByUserName(username: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.USER_PROFILE, - username, - ].join(':'); - } - - public static allProfilesOfUser(userId: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.USER_PROFILES, - userId, - ].join(':'); - } - - public static userSettingsOfUser(userId: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.USER_SETTING, - userId, - ].join(':'); - } - - public static userOwnershipNftLinked(userId: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.USER_OWNERSHIP_NFT_LINKED, - userId, - ].join(':'); - } - - /** - * @deprecated - */ - public static getTokenValidationHashKey(username: string): string { - return [SharedUserCacheKey.PREFIX, CACHE_KEYS.TOKEN_VALIDATION.HASH, username].join(':'); - } - - public static getUserCronHealthCheckKey(identifier: string): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - 'USER_CRON_JOB', - identifier, - ].join(':'); - } - - public static getReferralLeaderboardRankingsKey(): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.REFERRAL_LEADERBOARD.RANKINGS, - ].join(':'); - } - - public static getReferralLeaderboardUpdatedAtKey(): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.REFERRAL_LEADERBOARD.UPDATED_AT, - ].join(':'); - } - - public static getReferralLeaderboardLatestSnapshotTSKey(): string { - return [ - SharedUserCacheKey.PREFIX, - SharedUserCacheKey.hashTag, - CACHE_KEYS.REFERRAL_LEADERBOARD.SNAPSHOT_TS, - ].join(':'); - } -} diff --git a/src/subscription.dto.ts b/src/subscription.dto.ts index f28e311..6c372f1 100644 --- a/src/subscription.dto.ts +++ b/src/subscription.dto.ts @@ -12,3 +12,24 @@ export interface IFeatureAttributes { [FEATURE_PROPERTIES.MAX]?: number; [FEATURE_PROPERTIES.LEVEL]?: number; } + +export enum PREMIUM_PACKAGE_TYPE { + BASIC = 'basic', + PREMIUM = 'premium', +} + +export enum PREMIUM_PACKAGE_TERM { + ANNUAL = 'annual', + LIFETIME = 'lifetime', +} + +export class BindedUserSubscriptionDto { + id: string; + userId: string; + packageId: string; + packageKey: string; + type: PREMIUM_PACKAGE_TYPE; + term: PREMIUM_PACKAGE_TERM; + effectiveStart: Date; + effectiveEnd?: Date; +} diff --git a/src/user.dto.ts b/src/user.dto.ts index 58b181a..61e836a 100644 --- a/src/user.dto.ts +++ b/src/user.dto.ts @@ -6,7 +6,6 @@ import { USER_INVITATION_PRIVACY, USER_RELATIONSHIP_STATUS, USER_STAFF_ROLE, - USER_VISIBILITY_PRIVACY, } from '@beincom/constants'; class CommunityInfo { @@ -53,28 +52,14 @@ export class UserDto { relationshipStatus: USER_RELATIONSHIP_STATUS; isDeactivated: boolean; isVerified: boolean; - /** - * @note this field is required in the next major release. - */ - isPhoneVerified?: boolean; - /** - * @note this field is required in the next major release. - */ - isProfsCreator?: boolean; - - /** - * @warning These fields are not optional. Must be a required field in the next major release. - */ - referralCode?: string; + isPhoneVerified: boolean; + isProfsCreator: boolean; + referralCode: string; primaryId?: string; - latestWork?: LatestWorkExperienceDto; showingBadges?: ShowingBadgeDto[]; - shouldCreatePwd?: boolean; - - interests?: INTEREST[]; - + interests: INTEREST[]; createdAt: Date; updatedAt: Date; deletedAt?: Date; @@ -95,22 +80,16 @@ export interface SharedUserDto { } export class UserSettingDto { - visibilityPrivacy: USER_VISIBILITY_PRIVACY; + userId: string; invitationPrivacy: USER_INVITATION_PRIVACY; - directMessagePrivacy?: USER_DIRECT_MESSAGE_PRIVACY; + directMessagePrivacy: USER_DIRECT_MESSAGE_PRIVACY; language: LANGUAGE; - /** - * @note this field is required in the next major release. - */ - showOwnedCommunities?: boolean; - /** - * @note this field is required in the next major release. - */ - showJoinedCommunities?: boolean; - /** - * @note this field is required in the next major release. - */ - showContent?: boolean; + showOwnedCommunities: boolean; + showJoinedCommunities: boolean; + showContent: boolean; + showPersonalInfo: boolean; + createdAt?: Date; + updatedAt?: Date; } export class UserPublicInfoDto {