dgc-core 2.0.3 → 2.0.4

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.
@@ -184,9 +184,8 @@ function submitEntry(g, account, raw) {
184
184
  return {
185
185
  giveawayId: g._id,
186
186
  userId: account.userId,
187
- name: account.name,
187
+ name: [account.firstName?.trim(), account.lastName?.trim()].filter(Boolean).join(' '),
188
188
  email: account.email,
189
- username: account.username,
190
189
  country,
191
190
  _collectorType: account._collectorType,
192
191
  enteredAt: at,
@@ -56,7 +56,6 @@ export declare class GiveawayRepository {
56
56
  name: string;
57
57
  giveawayId: import("../types").GiveawayObjectId;
58
58
  enteredAt: string;
59
- username?: string | undefined;
60
59
  rulesSnapshot: string;
61
60
  userId: string;
62
61
  address?: import("../types").GiveawayDeliveryAddress | undefined;
@@ -22,10 +22,13 @@ function serialize(record) {
22
22
  return { ...record, _id: record._id.toHexString() };
23
23
  }
24
24
  const statuses = Object.values(giveaway_2.GiveawayStatus);
25
- /** Normalize historical entry names at read boundaries without rewriting stored records. */
25
+ /** Normalize historical names and omit retired usernames without rewriting stored records. */
26
26
  function normalizeEntry(record) {
27
- const { fullName, ...fields } = record;
28
- return { ...fields, name: record.name ?? fullName ?? '' };
27
+ const legacy = record;
28
+ const fields = { ...legacy };
29
+ delete fields.fullName;
30
+ delete fields.username;
31
+ return { ...fields, name: record.name ?? legacy.fullName ?? '' };
29
32
  }
30
33
  function pagination(params) {
31
34
  const integer = (key, fallback, max) => {
@@ -419,7 +422,6 @@ class GiveawayRepository {
419
422
  'name',
420
423
  'fullName',
421
424
  '_id',
422
- 'username',
423
425
  'email',
424
426
  'userId',
425
427
  'address.line1',
@@ -963,7 +965,6 @@ class GiveawayRepository {
963
965
  _id: entry._id,
964
966
  giveawayId: entry.giveawayId,
965
967
  enteredAt: entry.enteredAt,
966
- username: entry.username,
967
968
  tickets: 1,
968
969
  rulesSnapshot: entry.rulesSnapshot
969
970
  },
@@ -75,7 +75,6 @@ export type GiveawayEntry = {
75
75
  /** Historical entry addresses are retained; new entries collect delivery only at claim. */
76
76
  address?: GiveawayDeliveryAddress;
77
77
  country?: string;
78
- username?: string;
79
78
  /** Null only for legacy entries whose exact collector tier was not recorded. */
80
79
  _collectorType: UserCollectorType | null;
81
80
  enteredAt: string;
@@ -180,9 +179,8 @@ export type GiveawayOverviewData = {
180
179
  liveGiveaways: GiveawaySummary[];
181
180
  needsSelection: Giveaway[];
182
181
  };
183
- export type GiveawayUserProfile = Pick<FbUser, 'email' | 'name' | '_collectorType'> & {
182
+ export type GiveawayUserProfile = Pick<FbUser, 'email' | 'firstName' | 'lastName' | '_collectorType'> & {
184
183
  userId: string;
185
- username?: string;
186
184
  };
187
185
  export type GiveawayPhysicalClaim = {
188
186
  fullName: string;
@@ -190,7 +188,7 @@ export type GiveawayPhysicalClaim = {
190
188
  contactNumber: string;
191
189
  };
192
190
  export type GiveawayTicket = {
193
- entry: Pick<GiveawayEntry, '_id' | 'giveawayId' | 'enteredAt' | 'username' | 'rulesSnapshot'> & {
191
+ entry: Pick<GiveawayEntry, '_id' | 'giveawayId' | 'enteredAt' | 'rulesSnapshot'> & {
194
192
  tickets: 1;
195
193
  };
196
194
  giveaway: Pick<Giveaway, '_id' | 'title' | 'image' | 'creditAmount' | 'closesAt' | 'status' | 'category'>;
@@ -8,10 +8,8 @@ export type FbUser = {
8
8
  count: number;
9
9
  };
10
10
  email: string;
11
- /** Full name stored on the Firebase account. */
12
- name: string;
13
11
  fcmTokens: Record<string, boolean>;
14
- firstName: string;
12
+ firstName?: string;
15
13
  fundAmount: number;
16
14
  fundalert: number;
17
15
  id: string;
@@ -22,7 +20,7 @@ export type FbUser = {
22
20
  isFacebookUser: boolean;
23
21
  lastCardIndex: number;
24
22
  lastGradingTime: number;
25
- lastName: string;
23
+ lastName?: string;
26
24
  soldCards: {
27
25
  count: number;
28
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dgc-core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Shared DGC contracts, business rules and server utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",