@brimble/models 2.5.2 → 2.5.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.
- package/dist/token.js +3 -2
- package/dist/types/token.d.ts +2 -1
- package/package.json +1 -1
- package/token.ts +3 -2
- package/types/token.ts +2 -1
package/dist/token.js
CHANGED
|
@@ -8,7 +8,8 @@ const tokenSchema = new mongoose_1.Schema({
|
|
|
8
8
|
required: true,
|
|
9
9
|
},
|
|
10
10
|
owner_id: {
|
|
11
|
-
type:
|
|
11
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
12
|
+
ref: "User",
|
|
12
13
|
required: true,
|
|
13
14
|
unique: true,
|
|
14
15
|
},
|
|
@@ -32,4 +33,4 @@ const tokenSchema = new mongoose_1.Schema({
|
|
|
32
33
|
default: 0
|
|
33
34
|
},
|
|
34
35
|
}, { timestamps: true });
|
|
35
|
-
exports.default = (0, mongoose_1.model)("Token", tokenSchema, "
|
|
36
|
+
exports.default = (0, mongoose_1.model)("Token", tokenSchema, "api_tokens");
|
package/dist/types/token.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { ISubscription } from "./subscription";
|
|
3
|
+
import { IUser } from "./user";
|
|
3
4
|
export interface IToken extends Document {
|
|
4
5
|
subscription_id: ISubscription;
|
|
5
|
-
owner_id:
|
|
6
|
+
owner_id: IUser;
|
|
6
7
|
key_id: string;
|
|
7
8
|
key: string;
|
|
8
9
|
tokens_remaining: number;
|
package/package.json
CHANGED
package/token.ts
CHANGED
|
@@ -9,7 +9,8 @@ const tokenSchema = new Schema<IToken>(
|
|
|
9
9
|
required: true,
|
|
10
10
|
},
|
|
11
11
|
owner_id: {
|
|
12
|
-
type:
|
|
12
|
+
type: Schema.Types.ObjectId,
|
|
13
|
+
ref: "User",
|
|
13
14
|
required: true,
|
|
14
15
|
unique: true,
|
|
15
16
|
},
|
|
@@ -36,4 +37,4 @@ const tokenSchema = new Schema<IToken>(
|
|
|
36
37
|
{ timestamps: true },
|
|
37
38
|
);
|
|
38
39
|
|
|
39
|
-
export default model<IToken>("Token", tokenSchema, "
|
|
40
|
+
export default model<IToken>("Token", tokenSchema, "api_tokens");
|
package/types/token.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Document } from "mongoose";
|
|
2
2
|
import { ISubscription } from "./subscription";
|
|
3
|
+
import { IUser } from "./user";
|
|
3
4
|
|
|
4
5
|
export interface IToken extends Document {
|
|
5
6
|
subscription_id: ISubscription;
|
|
6
|
-
owner_id:
|
|
7
|
+
owner_id: IUser;
|
|
7
8
|
key_id: string;
|
|
8
9
|
key: string;
|
|
9
10
|
tokens_remaining: number;
|