UNPKG

2.61 kBSource Map (JSON)View Raw
1{"version":3,"file":"UserModel.js","names":["UserModel","statusName","statuses","Date","markModified","Model","schema","role","type","String","email","password","name","avatar","profile","Object","info","signinAt","editAt","activityAt","passwordAt","options","model","collection","views","tiny"],"sources":["../../src/models/UserModel.js"],"sourcesContent":["import Model from '@lskjs/db/Model';\n\nexport class UserModel extends Model {\n static schema = {\n role: {\n type: String,\n },\n email: {\n type: String,\n },\n password: {\n type: String,\n },\n name: {\n type: String,\n },\n avatar: {\n type: String,\n },\n profile: {\n type: Object,\n },\n info: {\n type: Object,\n },\n private: {\n type: Object,\n },\n statuses: {\n signinAt: {\n type: Date,\n },\n editAt: {\n type: Date,\n },\n activityAt: {\n type: Date,\n },\n passwordAt: {\n type: Date,\n },\n },\n };\n static options = {\n model: 'UserModel ',\n collection: 'user',\n };\n\n setStatus(statusName) {\n if (!this.statuses) this.statuses = {};\n this.statuses[statusName] = new Date();\n this.markModified(`statuses.${statusName}`);\n }\n\n static views = {\n tiny: ['_id', 'role', 'name', 'avatar'],\n default: ['_id', 'role', 'name', 'avatar'],\n };\n}\n\nexport default UserModel;\n"],"mappings":";;;;;;;;;;;;AAAA;AAAoC;AAAA;AAAA,IAEvBA,SAAS;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA,OA8CpB,mBAAUC,UAAU,EAAE;MACpB,IAAI,CAAC,IAAI,CAACC,QAAQ,EAAE,IAAI,CAACA,QAAQ,GAAG,CAAC,CAAC;MACtC,IAAI,CAACA,QAAQ,CAACD,UAAU,CAAC,GAAG,IAAIE,IAAI,EAAE;MACtC,IAAI,CAACC,YAAY,oBAAaH,UAAU,EAAG;IAC7C;EAAC;EAAA;AAAA,EAlD4BI,kBAAK;AAAA;AAAvBL,SAAS,CACbM,MAAM,GAAG;EACdC,IAAI,EAAE;IACJC,IAAI,EAAEC;EACR,CAAC;EACDC,KAAK,EAAE;IACLF,IAAI,EAAEC;EACR,CAAC;EACDE,QAAQ,EA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