Skip to content

Commit 42f9736

Browse files
committed
feat(users): add user's external identities model
Signed-off-by: Álvaro Orduna León <[email protected]>
1 parent 6adfc35 commit 42f9736

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

packages/leemons-users/src/types.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ export interface User {
3434
avatarAsset: AssetID;
3535
locale: string;
3636
gender: string;
37-
bithdate: Date;
37+
birthdate: Date;
3838
center?: Center;
39+
externalIdentities?: {
40+
provider: string;
41+
externalId: string;
42+
}[];
3943
}
4044

4145
export interface UserAgent {

plugins/leemons-plugin-users/backend/models/users.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
const { mongoose, newModel } = require('@leemons/mongodb');
22

3+
const externalIdentitySchema = new mongoose.Schema({
4+
provider: {
5+
type: String,
6+
required: true,
7+
},
8+
externalId: {
9+
type: String,
10+
required: true,
11+
},
12+
});
13+
314
const schema = new mongoose.Schema(
415
{
516
id: {
@@ -58,6 +69,11 @@ const schema = new mongoose.Schema(
5869
type: String,
5970
required: true,
6071
},
72+
externalIdentities: {
73+
type: [externalIdentitySchema],
74+
required: false,
75+
default: [],
76+
},
6177
},
6278
{
6379
timestamps: true,

0 commit comments

Comments
 (0)