@skroz/profile-api 1.0.22 → 1.0.24

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.
@@ -0,0 +1,6 @@
1
+ import { BaseEntity as TypeORMBaseEntity } from 'typeorm';
2
+ export declare abstract class TypeOrmBaseEntity extends TypeORMBaseEntity {
3
+ id: number;
4
+ createdAt: Date;
5
+ updatedAt: Date;
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TypeOrmBaseEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const type_graphql_1 = require("type-graphql");
15
+ let TypeOrmBaseEntity = class TypeOrmBaseEntity extends typeorm_1.BaseEntity {
16
+ };
17
+ exports.TypeOrmBaseEntity = TypeOrmBaseEntity;
18
+ __decorate([
19
+ (0, type_graphql_1.Field)(() => type_graphql_1.ID),
20
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
21
+ __metadata("design:type", Number)
22
+ ], TypeOrmBaseEntity.prototype, "id", void 0);
23
+ __decorate([
24
+ (0, type_graphql_1.Field)(),
25
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
26
+ __metadata("design:type", Date)
27
+ ], TypeOrmBaseEntity.prototype, "createdAt", void 0);
28
+ __decorate([
29
+ (0, type_graphql_1.Field)(),
30
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
31
+ __metadata("design:type", Date)
32
+ ], TypeOrmBaseEntity.prototype, "updatedAt", void 0);
33
+ exports.TypeOrmBaseEntity = TypeOrmBaseEntity = __decorate([
34
+ (0, type_graphql_1.ObjectType)({ isAbstract: true })
35
+ ], TypeOrmBaseEntity);
@@ -1,12 +1,9 @@
1
- import { BaseEntity as TypeORMBaseEntity } from 'typeorm';
2
- export declare abstract class TypeOrmBaseUser extends TypeORMBaseEntity {
1
+ import { TypeOrmBaseEntity } from './TypeOrmBaseEntity';
2
+ export declare abstract class TypeOrmBaseUser extends TypeOrmBaseEntity {
3
3
  static config: {
4
4
  isOnlineSeconds: number;
5
5
  isOnlineRecentlySeconds: number;
6
6
  };
7
- id: number;
8
- createdAt: Date;
9
- updatedAt: Date;
10
7
  email: string | null;
11
8
  password: string;
12
9
  isTempPassword: boolean;
@@ -13,7 +13,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.TypeOrmBaseUser = void 0;
14
14
  const typeorm_1 = require("typeorm");
15
15
  const type_graphql_1 = require("type-graphql");
16
- let TypeOrmBaseUser = TypeOrmBaseUser_1 = class TypeOrmBaseUser extends typeorm_1.BaseEntity {
16
+ const TypeOrmBaseEntity_1 = require("./TypeOrmBaseEntity");
17
+ let TypeOrmBaseUser = TypeOrmBaseUser_1 = class TypeOrmBaseUser extends TypeOrmBaseEntity_1.TypeOrmBaseEntity {
17
18
  checkOnline(seconds) {
18
19
  if (!this.lastSeenAt)
19
20
  return false;
@@ -33,21 +34,6 @@ TypeOrmBaseUser.config = {
33
34
  isOnlineSeconds: 60,
34
35
  isOnlineRecentlySeconds: 300,
35
36
  };
36
- __decorate([
37
- (0, type_graphql_1.Field)(() => type_graphql_1.ID),
38
- (0, typeorm_1.PrimaryGeneratedColumn)(),
39
- __metadata("design:type", Number)
40
- ], TypeOrmBaseUser.prototype, "id", void 0);
41
- __decorate([
42
- (0, type_graphql_1.Field)(() => type_graphql_1.GraphQLTimestamp),
43
- (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
44
- __metadata("design:type", Date)
45
- ], TypeOrmBaseUser.prototype, "createdAt", void 0);
46
- __decorate([
47
- (0, type_graphql_1.Field)(() => type_graphql_1.GraphQLTimestamp),
48
- (0, typeorm_1.UpdateDateColumn)({ type: 'timestamptz' }),
49
- __metadata("design:type", Date)
50
- ], TypeOrmBaseUser.prototype, "updatedAt", void 0);
51
37
  __decorate([
52
38
  (0, typeorm_1.Column)({ type: 'varchar', nullable: true, unique: true }),
53
39
  __metadata("design:type", Object)
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  export * from './adapters/TypeOrmProfileAdapter';
3
+ export * from './entities/TypeOrmBaseEntity';
3
4
  export * from './entities/TypeOrmBaseUser';
4
5
  export * from './services/ProfileAuthService';
5
6
  export * from './services/ProfileEmailService';
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types"), exports);
18
18
  __exportStar(require("./adapters/TypeOrmProfileAdapter"), exports);
19
+ __exportStar(require("./entities/TypeOrmBaseEntity"), exports);
19
20
  __exportStar(require("./entities/TypeOrmBaseUser"), exports);
20
21
  __exportStar(require("./services/ProfileAuthService"), exports);
21
22
  __exportStar(require("./services/ProfileEmailService"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skroz/profile-api",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "license": "MIT",
5
5
  "repository": "git@gitlab.com:skroz/libs/utils.git",
6
6
  "main": "dist/index.js",
@@ -44,5 +44,5 @@
44
44
  "type-graphql": "^1.1.1",
45
45
  "typeorm": "^0.2.45"
46
46
  },
47
- "gitHead": "b76953b60d5790c28dd02476788130a62c255a94"
47
+ "gitHead": "b3531fbaf9016d5f69ec9a0d55dd789635c276aa"
48
48
  }
@@ -0,0 +1,22 @@
1
+ import {
2
+ BaseEntity as TypeORMBaseEntity,
3
+ CreateDateColumn,
4
+ PrimaryGeneratedColumn,
5
+ UpdateDateColumn,
6
+ } from 'typeorm';
7
+ import { Field, ID, ObjectType } from 'type-graphql';
8
+
9
+ @ObjectType({ isAbstract: true })
10
+ export abstract class TypeOrmBaseEntity extends TypeORMBaseEntity {
11
+ @Field(() => ID)
12
+ @PrimaryGeneratedColumn()
13
+ public id!: number;
14
+
15
+ @Field()
16
+ @CreateDateColumn({ type: 'timestamptz' })
17
+ public createdAt!: Date;
18
+
19
+ @Field()
20
+ @UpdateDateColumn({ type: 'timestamptz' })
21
+ public updatedAt!: Date;
22
+ }
@@ -1,31 +1,14 @@
1
- import {
2
- Column,
3
- CreateDateColumn,
4
- PrimaryGeneratedColumn,
5
- UpdateDateColumn,
6
- BaseEntity as TypeORMBaseEntity,
7
- } from 'typeorm';
8
- import { Field, ID, ObjectType, GraphQLTimestamp } from 'type-graphql';
1
+ import { Column } from 'typeorm';
2
+ import { Field, ObjectType, GraphQLTimestamp } from 'type-graphql';
3
+ import { TypeOrmBaseEntity } from './TypeOrmBaseEntity';
9
4
 
10
5
  @ObjectType({ isAbstract: true })
11
- export abstract class TypeOrmBaseUser extends TypeORMBaseEntity {
6
+ export abstract class TypeOrmBaseUser extends TypeOrmBaseEntity {
12
7
  public static config = {
13
8
  isOnlineSeconds: 60,
14
9
  isOnlineRecentlySeconds: 300,
15
10
  };
16
11
 
17
- @Field(() => ID)
18
- @PrimaryGeneratedColumn()
19
- public id!: number;
20
-
21
- @Field(() => GraphQLTimestamp)
22
- @CreateDateColumn({ type: 'timestamptz' })
23
- public createdAt!: Date;
24
-
25
- @Field(() => GraphQLTimestamp)
26
- @UpdateDateColumn({ type: 'timestamptz' })
27
- public updatedAt!: Date;
28
-
29
12
  @Column({ type: 'varchar', nullable: true, unique: true })
30
13
  public email!: string | null;
31
14
 
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  export * from './adapters/TypeOrmProfileAdapter';
3
+ export * from './entities/TypeOrmBaseEntity';
3
4
  export * from './entities/TypeOrmBaseUser';
4
5
  export * from './services/ProfileAuthService';
5
6
  export * from './services/ProfileEmailService';