<commit_before>import { prop, getModelForClass, ReturnModelType, Severity, modelOptions } from '@typegoose/typegoose'

class Credentials {
  @prop({ required: true, unique: true })
  username: string
  @prop({ required: true })
  salt: string
  @prop({ required: true })
  hashedPassword: string
  @prop({ required: true })
  parentName: string
  @prop({ required: true })
  parentCUIL: string
}
@modelOptions({ options: { allowMixed: Severity.ALLOW } })
export class User {
  @prop({ _id: false, required: true })
  credentials: Credentials

  @prop({ _id: false })
  profile: {
    nickName: string
    avatarURL: string
  }

  static findByUsername(this: ReturnModelType<typeof User>, username: string) {
    return this.findOne({ 'credentials.username': username })
  }
}


export default getModelForClass<typeof User>(User)<commit_msg>Optional email<commit_after>import { prop, getModelForClass, ReturnModelType, Severity, modelOptions } from '@typegoose/typegoose'

class Credentials {
  @prop({ required: true, unique: true })
  username: string
  @prop({ required: true })
  salt: string
  @prop({ required: true })
  hashedPassword: string
  @prop({ required: true })
  parentName: string
  @prop({ required: true })
  parentCUIL: string
  @prop()
  email: string
}
@modelOptions({ options: { allowMixed: Severity.ALLOW } })
export class User {
  @prop({ _id: false, required: true })
  credentials: Credentials

  @prop({ _id: false })
  profile: {
    nickName: string
    avatarURL: string
  }

  static findByUsername(this: ReturnModelType<typeof User>, username: string) {
    return this.findOne({ 'credentials.username': username })
  }
}


export default getModelForClass<typeof User>(User)
{'fraction_non_alphanumeric': 0.1265377855887522, 'fraction_numerical': 0.0, 'mean_word_length': 4.6, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '612944', 'n_tokens_mistral': 532, 'n_tokens_neox': 522, 'n_words': 149}