mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
import { Mongo } from 'meteor/mongo';
|
|
const { SimpleSchema } = require('/imports/simpleSchema');
|
|
|
|
const Translation = new Mongo.Collection('translation');
|
|
|
|
/**
|
|
* A Organization User in wekan
|
|
*/
|
|
Translation.attachSchema(
|
|
new SimpleSchema({
|
|
language: {
|
|
/**
|
|
* the language
|
|
*/
|
|
type: String,
|
|
max: 5,
|
|
},
|
|
text: {
|
|
/**
|
|
* the text
|
|
*/
|
|
type: String,
|
|
},
|
|
translationText: {
|
|
/**
|
|
* the translation text
|
|
*/
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
createdAt: {
|
|
/**
|
|
* creation date of the translation custom string
|
|
*/
|
|
type: Date,
|
|
// eslint-disable-next-line consistent-return
|
|
autoValue() {
|
|
if (this.isInsert) {
|
|
return new Date();
|
|
} else if (this.isUpsert) {
|
|
return { $setOnInsert: new Date() };
|
|
} else {
|
|
this.unset();
|
|
}
|
|
},
|
|
},
|
|
modifiedAt: {
|
|
type: Date,
|
|
// eslint-disable-next-line consistent-return
|
|
autoValue() {
|
|
if (this.isInsert || this.isUpsert || this.isUpdate) {
|
|
return new Date();
|
|
} else {
|
|
this.unset();
|
|
}
|
|
},
|
|
},
|
|
}),
|
|
);
|
|
|
|
export default Translation;
|