90dc-core 1.3.0 → 1.3.1

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.
@@ -1,4 +1,4 @@
1
- import { Model } from 'sequelize-typescript';
1
+ import { Model } from "sequelize-typescript";
2
2
  export declare class PersistedUser extends Model {
3
3
  userUuid: string;
4
4
  email: string;
@@ -10,6 +10,7 @@ export declare class PersistedUser extends Model {
10
10
  goal: string;
11
11
  isFreeVersion: boolean;
12
12
  allowsEmail: boolean;
13
+ gotParentalConsent: boolean;
13
14
  weightGoal: string;
14
15
  role: 'default' | 'admin';
15
16
  level: string;
@@ -28,5 +29,4 @@ export declare class PersistedUser extends Model {
28
29
  changeEmail: boolean;
29
30
  changeUtilityEmail: boolean;
30
31
  subscription: object;
31
- $addFriend(friendUuid: string): Promise<void>;
32
32
  }
@@ -7,21 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { Column, DataType, Default, Model, Table } from 'sequelize-typescript';
11
- import { UsersFriends } from './UsersFriends';
10
+ import { Column, DataType, Default, Index, Model, Table } from "sequelize-typescript";
12
11
  let PersistedUser = class PersistedUser extends Model {
13
- async $addFriend(friendUuid) {
14
- await UsersFriends.create({
15
- userId: this.userUuid,
16
- friendId: friendUuid,
17
- createDate: new Date()
18
- });
19
- await UsersFriends.create({
20
- userId: friendUuid,
21
- friendId: this.userUuid,
22
- createDate: new Date()
23
- });
24
- }
25
12
  };
26
13
  __decorate([
27
14
  Default(DataType.UUIDV4),
@@ -34,6 +21,7 @@ __decorate([
34
21
  __metadata("design:type", String)
35
22
  ], PersistedUser.prototype, "userUuid", void 0);
36
23
  __decorate([
24
+ Index,
37
25
  Column({ type: DataType.TEXT, allowNull: false, unique: false }),
38
26
  __metadata("design:type", String)
39
27
  ], PersistedUser.prototype, "email", void 0);
@@ -69,6 +57,10 @@ __decorate([
69
57
  Column({ type: DataType.BOOLEAN, allowNull: true }),
70
58
  __metadata("design:type", Boolean)
71
59
  ], PersistedUser.prototype, "allowsEmail", void 0);
60
+ __decorate([
61
+ Column({ type: DataType.BOOLEAN, allowNull: true }),
62
+ __metadata("design:type", Boolean)
63
+ ], PersistedUser.prototype, "gotParentalConsent", void 0);
72
64
  __decorate([
73
65
  Column({ type: DataType.TEXT, allowNull: true }),
74
66
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Model, Table } from 'sequelize-typescript';\nimport { UsersFriends } from './UsersFriends';\n\n@Table\nexport class PersistedUser extends Model {\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: true })\n declare subscription: object;\n\n async $addFriend(friendUuid: string) {\n await UsersFriends.create({\n userId: this.userUuid,\n friendId: friendUuid,\n createDate: new Date()\n });\n\n await UsersFriends.create({\n userId: friendUuid,\n friendId: this.userUuid,\n createDate: new Date()\n });\n }\n}\n"],"names":["Column","DataType","Default","Model","Table","UsersFriends","PersistedUser","$addFriend","friendUuid","create","userId","userUuid","friendId","createDate","Date","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAC/E,SAASC,YAAY,QAAQ,iBAAiB;AAG9C,WAAaC,gBAAN,4BAA4BH;IA2FjC,MAAMI,WAAWC,UAAkB,EAAE;QACnC,MAAMH,aAAaI,MAAM,CAAC;YACxBC,QAAQ,IAAI,CAACC,QAAQ;YACrB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GAxFrCb;AAAAA;IADZF;GACYE"}
1
+ {"version":3,"sources":["../../../src/lib/dbmodels/PersistedUser.ts"],"sourcesContent":["import { Column, DataType, Default, Index, Model, Table } from \"sequelize-typescript\";\n\n@Table\nexport class PersistedUser extends Model {\n\n @Default(DataType.UUIDV4)\n @Column({\n type: DataType.UUID,\n defaultValue: DataType.UUID,\n allowNull: false,\n primaryKey: true\n })\n declare userUuid: string;\n\n @Index\n @Column({ type: DataType.TEXT, allowNull: false, unique: false })\n declare email: string;\n\n @Column({ type: DataType.TEXT, allowNull: false })\n declare password: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare firstName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare lastName?: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare avatar: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare sex: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare goal: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare isFreeVersion: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare allowsEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare gotParentalConsent: boolean;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weightGoal: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare role: 'default' | 'admin';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare level: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare type: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare days: number;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare dateOfBirth: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare metricSystem: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare height: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare weight: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare activeProgramId: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationDate: string;\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare registrationService: 'apple' | 'google' | 'facebook' | 'native';\n\n @Column({ type: DataType.TEXT, allowNull: true })\n declare utilityEmail: string;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare emailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare utilityEmailConfirmed: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeEmail: boolean;\n\n @Column({ type: DataType.BOOLEAN, allowNull: true })\n declare changeUtilityEmail: boolean;\n\n @Column({ type: DataType.JSONB, allowNull: true })\n declare subscription: object;\n\n}\n"],"names":["Column","DataType","Default","Index","Model","Table","PersistedUser","UUIDV4","type","UUID","defaultValue","allowNull","primaryKey","TEXT","unique","BOOLEAN","JSONB"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAGtF,WAAaC,gBAAN,4BAA4BF;AAgGnC,EAAC;;IA9FEF,QAAQD,SAASM,MAAM;IACvBP,OAAO;QACNQ,MAAMP,SAASQ,IAAI;QACnBC,cAAcT,SAASQ,IAAI;QAC3BE,WAAW,KAAK;QAChBC,YAAY,IAAI;IAClB;GARWN;;IAWVH;IACAH,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,KAAK;QAAEG,QAAQ,KAAK;IAAC;GAZpDR;;IAeVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,KAAK;IAAC;GAfrCL;;IAkBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GAlBpCL;;IAqBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GArBpCL;;IAwBVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GAxBpC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,IAAI;IAAC;GAxEpCL;;IA2EVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GA3EpCL;;IA8EVN,OAAO;QAAEQ,MAAMP,SAASY,IAAI;QAAEF,WAAW,IAAI;IAAC;GA9EpCL;;IAiFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAjFvCL;;IAoFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GApFvCL;;IAuFVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GAvFvCL;;IA0FVN,OAAO;QAAEQ,MAAMP,SAASc,OAAO;QAAEJ,WAAW,IAAI;IAAC;GA1FvCL;;IA6FVN,OAAO;QAAEQ,MAAMP,SAASe,KAAK;QAAEL,WAAW,IAAI;IAAC;GA7FrCL;AAAAA;IADZD;GACYC"}
@@ -1,5 +1,15 @@
1
- import winston from 'winston';
2
- declare class Logger {
3
- static getLogger(serviceName: string): winston.Logger;
1
+ import { Debugger } from "debug";
2
+ export declare class Log {
3
+ private static instance;
4
+ private readonly debugLib;
5
+ constructor(debug: Debugger);
6
+ static getInstance(): Log;
7
+ static extendInstance(name: string): Log;
8
+ debug(message: string): void;
9
+ info(message: string): void;
10
+ warn(message: string): void;
11
+ error(message: string | unknown, error?: unknown): void;
12
+ catchError(error: unknown): void;
13
+ catchErrorAndLogUuid(error: unknown): string;
14
+ extend(extensionName: string): Log;
4
15
  }
5
- export default Logger;
@@ -1,39 +1,64 @@
1
- import winston from 'winston';
2
- class Logger {
3
- static getLogger(serviceName) {
4
- const levels = {
5
- error: 0,
6
- warn: 1,
7
- info: 2,
8
- http: 3,
9
- debug: 4,
10
- };
11
- const level = () => {
12
- const env = process.env.NODE_ENV || 'development';
13
- const isDevelopment = env === 'development';
14
- return isDevelopment ? 'debug' : 'warn';
15
- };
16
- const colors = {
17
- error: 'red',
18
- warn: 'yellow',
19
- info: 'magenta',
20
- http: 'magenta',
21
- debug: 'white',
22
- serviceName: 'magenta'
23
- };
24
- winston.addColors(colors);
25
- const format = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }), winston.format.colorize({ all: true }), winston.format.printf(
26
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
27
- (info) => `\n @${serviceName.toUpperCase()}: ${info.message}\n`));
28
- const transports = [
29
- new winston.transports.Console(),
30
- ];
31
- return winston.createLogger({
32
- level: level(),
33
- levels,
34
- format,
35
- transports,
36
- });
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access */
2
+ import axios from "axios";
3
+ import Debug from "debug";
4
+ import * as crypto from "crypto";
5
+ export class Log {
6
+ static instance = null;
7
+ debugLib;
8
+ constructor(debug) {
9
+ this.debugLib = debug;
10
+ }
11
+ static getInstance() {
12
+ if (!Log.instance) {
13
+ const debug = Debug("@swish:" + (process.env.npm_package_name || "package-name-not-specified"));
14
+ Log.instance = new Log(debug);
15
+ }
16
+ return Log.instance;
17
+ }
18
+ static extendInstance(name) {
19
+ return this.getInstance().extend(name);
20
+ }
21
+ debug(message) {
22
+ this.debugLib(message);
23
+ }
24
+ info(message) {
25
+ // eslint-disable-next-line no-console
26
+ this.debugLib.log = console.info.bind(console);
27
+ this.debugLib(message);
28
+ }
29
+ warn(message) {
30
+ const warnDebug = this.debugLib.extend("warning");
31
+ // eslint-disable-next-line no-console
32
+ warnDebug.log = console.warn.bind(console);
33
+ warnDebug(message);
34
+ }
35
+ error(message, error) {
36
+ const errorDebug = this.debugLib.extend("error");
37
+ // eslint-disable-next-line no-console
38
+ errorDebug.log = console.error.bind(console);
39
+ errorDebug(message, error);
40
+ }
41
+ catchError(error) {
42
+ if (axios.isAxiosError(error)) {
43
+ this.error(error.toJSON());
44
+ }
45
+ if (typeof error === "string") {
46
+ error.toUpperCase(); // works, `e` narrowed to string
47
+ this.error(error);
48
+ }
49
+ else if (error instanceof Error) {
50
+ error.message; // works, `e` narrowed to Error
51
+ this.error(error.message);
52
+ }
53
+ }
54
+ catchErrorAndLogUuid(error) {
55
+ const uuid = crypto.randomUUID();
56
+ this.error(`ERROR UUID: ${uuid}`);
57
+ this.catchError(error);
58
+ return uuid;
59
+ }
60
+ extend(extensionName) {
61
+ const debugExtension = this.debugLib.extend(extensionName);
62
+ return new Log(debugExtension);
37
63
  }
38
64
  }
39
- export default Logger;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["import winston from 'winston'\n\nclass Logger {\n\n public static getLogger(serviceName: string){\n const levels = {\n error: 0,\n warn: 1,\n info: 2,\n http: 3,\n debug: 4,\n }\n\n const level = () => {\n const env = process.env.NODE_ENV || 'development'\n const isDevelopment = env === 'development'\n return isDevelopment ? 'debug' : 'warn'\n }\n\n const colors = {\n error: 'red',\n warn: 'yellow',\n info: 'magenta',\n http: 'magenta',\n debug: 'white',\n serviceName: 'magenta'\n }\n\n winston.addColors(colors)\n\n const format: winston.Logform.Format = winston.format.combine(\n winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),\n winston.format.colorize({ all: true }),\n winston.format.printf(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n (info) => `\\n @${serviceName.toUpperCase()}: ${info.message}\\n`,\n ),\n )\n\n const transports = [\n new winston.transports.Console(),\n ]\n return winston.createLogger({\n level: level(),\n levels,\n format,\n transports,\n })\n\n }\n}\n\n\nexport default Logger"],"names":["winston","Logger","getLogger","serviceName","levels","error","warn","info","http","debug","level","env","process","NODE_ENV","isDevelopment","colors","addColors","format","combine","timestamp","colorize","all","printf","toUpperCase","message","transports","Console","createLogger"],"mappings":"AAAA,OAAOA,aAAa,UAAS;AAE7B,MAAMC;IAEJ,OAAcC,UAAUC,WAAmB,EAAC;QAC1C,MAAMC,SAAS;YACbC,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;QACT;QAEA,MAAMC,QAAQ,IAAM;YAClB,MAAMC,MAAMC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YACpC,MAAMC,gBAAgBH,QAAQ;YAC9B,OAAOG,gBAAgB,UAAU,MAAM;QACzC;QAEA,MAAMC,SAAS;YACbV,OAAO;YACPC,MAAM;YACNC,MAAM;YACNC,MAAM;YACNC,OAAO;YACPN,aAAa;QACf;QAEAH,QAAQgB,SAAS,CAACD;QAElB,MAAME,SAAiCjB,QAAQiB,MAAM,CAACC,OAAO,CAC3DlB,QAAQiB,MAAM,CAACE,SAAS,CAAC;YAAEF,QAAQ;QAAyB,IAC5DjB,QAAQiB,MAAM,CAACG,QAAQ,CAAC;YAAEC,KAAK,IAAI;QAAC,IACpCrB,QAAQiB,MAAM,CAACK,MAAM,CACnB,4EAA4E;QAC7E,CAACf,OAAS,CAAC,WAAW,EAAEJ,YAAYoB,WAAW,GAAG,EAAE,EAAEhB,KAAKiB,OAAO,CAAC,EAAE,CAAC;QAIzE,MAAMC,aAAa;YACjB,IAAIzB,QAAQyB,UAAU,CAACC,OAAO;SAC/B;QACD,OAAO1B,QAAQ2B,YAAY,CAAC;YAC1BjB,OAAOA;YACPN;YACAa;YACAQ;QACF;IAEF;AACF;AAGA,eAAexB,OAAM"}
1
+ {"version":3,"sources":["../../../src/lib/utils/Logger.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access */\nimport axios from \"axios\";\nimport Debug, { Debugger } from \"debug\";\nimport * as crypto from \"crypto\";\n\nexport class Log {\n private static instance: Log | null = null;\n private readonly debugLib: Debugger;\n\n constructor(debug: Debugger) {\n this.debugLib = debug;\n }\n\n public static getInstance(): Log {\n if (!Log.instance) {\n const debug: Debugger = Debug(\n \"@swish:\" + (process.env.npm_package_name || \"package-name-not-specified\")\n );\n Log.instance = new Log(debug);\n }\n\n return Log.instance;\n }\n\n public static extendInstance(name: string) {\n return this.getInstance().extend(name);\n }\n\n public debug(message: string): void {\n this.debugLib(message);\n }\n\n public info(message: string): void {\n // eslint-disable-next-line no-console\n this.debugLib.log = console.info.bind(console);\n this.debugLib(message);\n }\n\n public warn(message: string): void {\n const warnDebug: Debugger = this.debugLib.extend(\"warning\");\n // eslint-disable-next-line no-console\n warnDebug.log = console.warn.bind(console);\n warnDebug(message);\n }\n\n public error(message: string | unknown, error?: unknown): void {\n const errorDebug: Debugger = this.debugLib.extend(\"error\");\n // eslint-disable-next-line no-console\n errorDebug.log = console.error.bind(console);\n errorDebug(message, error);\n }\n\n public catchError(error: unknown): void {\n if (axios.isAxiosError(error)) {\n this.error(error.toJSON());\n }\n if (typeof error === \"string\") {\n error.toUpperCase(); // works, `e` narrowed to string\n this.error(error);\n } else if (error instanceof Error) {\n error.message; // works, `e` narrowed to Error\n this.error(error.message);\n }\n }\n\n public catchErrorAndLogUuid(error: unknown): string {\n const uuid: string = crypto.randomUUID();\n this.error(`ERROR UUID: ${uuid}`);\n this.catchError(error);\n\n return uuid;\n }\n\n public extend(extensionName: string): Log {\n const debugExtension: Debugger = this.debugLib.extend(extensionName);\n return new Log(debugExtension);\n }\n}"],"names":["axios","Debug","crypto","Log","instance","constructor","debug","debugLib","getInstance","process","env","npm_package_name","extendInstance","name","extend","message","info","log","console","bind","warn","warnDebug","error","errorDebug","catchError","isAxiosError","toJSON","toUpperCase","Error","catchErrorAndLogUuid","uuid","randomUUID","extensionName","debugExtension"],"mappings":"AAAA,uIAAuI,GACvI,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,WAAyB,QAAQ;AACxC,YAAYC,YAAY,SAAS;AAEjC,OAAO,MAAMC;IACX,OAAeC,WAAuB,IAAI,CAAC;IAG3CC,YAAYC,KAAe,CAAE;QAC3B,IAAI,CAACC,QAAQ,GAAGD;IAClB;IAEA,OAAcE,cAAmB;QAC/B,IAAI,CAACL,IAAIC,QAAQ,EAAE;YACjB,MAAME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AAU;QAClD,MAAMQ,OAAe5B,OAAO6B,UAAU;QACtC,IAAI,CAACT,KAAK,CAAC,CAAC,YAAY,EAAEQ,KAAK,CAAC;QAChC,IAAI,CAACN,UAAU,CAACF;QAEhB,OAAOQ;IACT;IAEOhB,OAAOkB,aAAqB,EAAO;QACxC,MAAMC,iBAA2B,IAAI,CAAC1B,QAAQ,CAACO,MAAM,CAACkB;QACtD,OAAO,IAAI7B,IAAI8B;IACjB;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "90dc-core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A package that contains utils and interfaces used to create 90dc",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -40,6 +40,9 @@ export class PersistedUser extends Model {
40
40
  @Column({ type: DataType.BOOLEAN, allowNull: true })
41
41
  declare allowsEmail: boolean;
42
42
 
43
+ @Column({ type: DataType.BOOLEAN, allowNull: true })
44
+ declare gotParentalConsent: boolean;
45
+
43
46
  @Column({ type: DataType.TEXT, allowNull: true })
44
47
  declare weightGoal: string;
45
48