Skip to content

Commit

Permalink
feat: ✨ add maxlength and default to UserDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
zhumeisongsong committed Dec 13, 2024
1 parent 90385d2 commit a5dd726
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libs/users/infrastructure/mongoose/src/lib/user.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import { Document } from 'mongoose';
@Schema()
export class UserDocument extends Document {
// refactor: move match regex to a shared lib
@Prop({ required: true, unique: true, match: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ })
@Prop({
required: true,
unique: true,
match: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
maxlength: 100,
})
email!: string;

@Prop({ required: false})
@Prop({ required: false, default: null, maxlength: 100 })
firstName!: string;
@Prop({ required: false })

@Prop({ required: false, default: null, maxlength: 100 })
lastName!: string;
}

Expand Down

0 comments on commit a5dd726

Please sign in to comment.