@social-mail/social-mail-web-server 1.4.821 → 1.4.823

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.4.821",
3
+ "version": "1.4.823",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -42,7 +42,7 @@ import RateLimitToken from "./entities/RateLimitToken.js";
42
42
  import AccessToken from "./entities/AccessToken.js";
43
43
  import ServerActivity from "./entities/ServerActivity.js";
44
44
  import IncomingSmsSource from "./entities/IncomingSmsSource.js";
45
- import VerificationToken from "./entities/VerificationToken.js";
45
+ import VerificationToken, { VerificationTokenAddress } from "./entities/VerificationToken.js";
46
46
 
47
47
  @RegisterScoped
48
48
  export default class SocialMailContext extends EntityContext {
@@ -189,6 +189,8 @@ export default class SocialMailContext extends EntityContext {
189
189
 
190
190
  public verificationTokens = this.model.register(VerificationToken);
191
191
 
192
+ public verificationTokenAddresses = this.model.register(VerificationTokenAddress);
193
+
192
194
  public tags = this.model.register(Tag);
193
195
 
194
196
  }
@@ -7,24 +7,14 @@ import DateTime from "@entity-access/entity-access/dist/types/DateTime.js";
7
7
  import GraphService from "@entity-access/server-pages/dist/services/GraphService.js";
8
8
  import SignerService from "../../services/SignerService.js";
9
9
  import Page from "@entity-access/server-pages/dist/Page.js";
10
+ import { RelateTo } from "@entity-access/entity-access/dist/decorators/Relate.js";
10
11
 
11
12
  @Table("VerificationTokens")
12
- @Index({
13
- name: "IX_VerificationTokens_Address",
14
- columns:[
15
- { name: (x) => x.address, descending: false }
16
- ],
17
- filter: (x) => x.verified === false
18
- })
19
13
  export default class VerificationToken {
20
14
 
21
15
  @Column({ dataType: "BigInt", key: true, generated: "identity"})
22
16
  verificationID: number;
23
17
 
24
- /** Phone Number or Email Address to Verify */
25
- @Column({ dataType: "Char", length: 200 })
26
- address: string;
27
-
28
18
  @Column({ default: () => Sql.date.now()})
29
19
  dateCreated: DateTime;
30
20
 
@@ -42,5 +32,25 @@ export default class VerificationToken {
42
32
 
43
33
  @Column({ dataType: "Char", length: 50, nullable: true })
44
34
  ipAddress: string;
35
+ addresses: VerificationTokenAddress[];
36
+
37
+ }
38
+
39
+ @Table("VerificationTokenAddresses")
40
+ export class VerificationTokenAddress {
41
+
42
+ @Column({ dataType: "BigInt", key: true })
43
+ @RelateTo(VerificationToken, {
44
+ property: (x) => x.verificationToken,
45
+ inverseProperty: (x) => x.addresses,
46
+ foreignKeyConstraint:{
47
+ cascade: "delete"
48
+ }
49
+ })
50
+ verificationID: number;
51
+
52
+ @Column({ dataType: "Char", length: 200 , key: true })
53
+ address: string;
45
54
 
55
+ verificationToken: VerificationToken;
46
56
  }
@@ -74,12 +74,6 @@ export default class IncomingSmsService {
74
74
  // notify...
75
75
  }
76
76
 
77
- await db.verificationTokens.where(px, (p) => (x) => x.address === p.phoneNumber
78
- && x.code === p.code
79
- && x.verified === false)
80
- .update(void 0, (p) => (x) => ({
81
- verified: true
82
- }));
83
77
 
84
78
 
85
79
  await db.userAuthFactors.where(px, (p) => (x) => x.phoneNumber === p.phoneNumber && x.secret === p.code)