somewhere

This commit is contained in:
Swift
2023-08-17 13:05:51 +03:30
parent 30c7eb0e7b
commit 53843207cc
429 changed files with 117489 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
const mongoose = require('mongoose')
const AnnouncementSchema = mongoose.Schema({
title: String,
caption: String,
seenBy: [mongoose.ObjectId],
expireDate: Number,
expired: { type: Boolean, default: false },
isForAgents: { type: Boolean, default: false },
_creator: { type: mongoose.ObjectId, ref: 'User' }
})
module.exports = mongoose.model('Announcement', AnnouncementSchema)
+36
View File
@@ -0,0 +1,36 @@
const mongoose = require('mongoose')
const BufferRequestSchema = mongoose.Schema({
// system structure
_openedBy: { type: mongoose.ObjectId, ref: 'User' },
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
user_id: { type: mongoose.ObjectId, ref: 'User' },
agent_id: { type: mongoose.ObjectId, ref: 'Representation' },
// form info
description: String,
createDate: String,
sendDate: String,
trackingCode: String,
items: [
{
ItemName: String,
ItemID: String,
ItemCode: String,
bufferQuantity: Number
}
],
// admin operations
seen: { type: Boolean, default: false },
status: { type: String, enum: ['temp', 'sent', 'ongoing', 'waiting', 'delivered'], default: 'temp' },
statusHistory: [
{
status: String,
date: Number
}
],
deliveryCode: String
})
module.exports = mongoose.model('BufferRequest', BufferRequestSchema)
+11
View File
@@ -0,0 +1,11 @@
const mongoose = require('mongoose')
const ContactPageMessageSchema = new mongoose.Schema({
full_name: String,
email: String,
message: String,
read: { type: Boolean, default: false },
read_by: { type: mongoose.ObjectId, ref: 'User' }
})
module.exports = mongoose.model('ContactPageMessage', ContactPageMessageSchema)
+9
View File
@@ -0,0 +1,9 @@
const mongoose = require('mongoose')
const FAQSchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
question: String,
answer: String
})
module.exports = mongoose.model('FAQ', FAQSchema)
+42
View File
@@ -0,0 +1,42 @@
const mongoose = require('mongoose')
const GuaranteeReportSchema = mongoose.Schema({
// system structure
_openedBy: { type: mongoose.ObjectId, ref: 'User' },
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
user_id: { type: mongoose.ObjectId, ref: 'User' },
agent_id: { type: mongoose.ObjectId, ref: 'Representation' },
// form info
description: String,
createDate: String,
sendDate: String,
trackingCode: String,
items: [
{
// customer info
customerName: String,
customerTel: String,
// product info
ItemName: String,
SerialNo1: String,
ItemID: String,
ItemCode: String,
// product issue
productIssue: String,
usedPieces: String,
// dates
recieveDate: String,
deliverDate: String
}
],
// admin operations
seen: { type: Boolean, default: false },
archived: { type: Boolean, default: false },
status: { type: String, enum: ['temp', 'sent'], default: 'temp' }
})
module.exports = mongoose.model('GuaranteeReport', GuaranteeReportSchema)
+8
View File
@@ -0,0 +1,8 @@
const mongoose = require('mongoose')
const HelpSchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
helpId: { type: mongoose.ObjectId, ref: 'Learning' }
})
module.exports = mongoose.model('Help', HelpSchema)
+27
View File
@@ -0,0 +1,27 @@
const mongoose = require('mongoose')
const paginate = require('mongoose-paginate-v2')
function video(vid) {
if (vid) return '/uploads/videos/' + vid
}
function image(img) {
return '/uploads/images/blog/' + img
}
function thumb(img) {
return '/uploads/images/blog/thumb/' + img
}
const LearningSchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
title: String,
short_description: String,
description: String,
cover: { type: String, get: image },
video: { type: String, get: video },
thumb: { type: String, get: thumb }
})
LearningSchema.plugin(paginate)
module.exports = mongoose.model('Learning', LearningSchema)
+23
View File
@@ -0,0 +1,23 @@
const mongoose = require('mongoose')
function image(img) {
if (img) return '/uploads/images/lottery/' + img
}
const LotterySchema = mongoose.Schema({
entryWidth: Number,
entryHeight: Number,
entryBgImg: { type: String, get: image },
resultWidth: Number,
resultHeight: Number,
resultBgImg: { type: String, get: image },
title: String,
lotteryCode: String,
participants: [],
winnersCount: { type: Number, default: 1 },
winnersList: [],
expireDate: Number,
expired: { type: Boolean, default: false }
})
module.exports = mongoose.model('Lottery', LotterySchema)
+16
View File
@@ -0,0 +1,16 @@
const mongoose = require('mongoose')
function image(img) {
if (img) return '/uploads/images/lottery/' + img
}
const LotteryPopUpSchema = mongoose.Schema({
visible: { type: Boolean, default: true },
x: { type: Number, default: 15 },
y: { type: Number, default: 15 },
w: { type: Number, default: 40 },
h: { type: Number, default: 40 },
bgImg: { type: String, get: image }
})
module.exports = mongoose.model('LotteryPopUp', LotteryPopUpSchema)
+45
View File
@@ -0,0 +1,45 @@
const mongoose = require('mongoose')
const OldPieceRequestSchema = mongoose.Schema({
// system structure
_openedBy: { type: mongoose.ObjectId, ref: 'User' },
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
user_id: { type: mongoose.ObjectId, ref: 'User' },
agent_id: { type: mongoose.ObjectId, ref: 'Representation' },
// form info
description: String,
createDate: String,
sendDate: String,
trackingCode: String,
items: [
{
// product info
ItemReceptionTransDate: String,
ItemName: String,
SerialNo1: String,
ItemID: String,
ItemCode: String,
// GStartDate: String,
// GEndDate: String,
// piece info
pieceName: String,
pieceCode: String,
pieceId: { type: mongoose.ObjectId, ref: 'Piece' }
}
],
// admin operations
seen: { type: Boolean, default: false },
status: { type: String, enum: ['temp', 'sent', 'ongoing', 'waiting', 'delivered'], default: 'temp' },
statusHistory: [
{
status: String,
date: Number
}
],
deliveryCode: String
})
module.exports = mongoose.model('OldPieceRequest', OldPieceRequestSchema)
+8
View File
@@ -0,0 +1,8 @@
const mongoose = require('mongoose')
const PieceSchema = mongoose.Schema({
name: String,
code: String
})
module.exports = mongoose.model('Piece', PieceSchema)
+47
View File
@@ -0,0 +1,47 @@
const mongoose = require('mongoose')
const PieceRequestSchema = mongoose.Schema({
// system structure
_openedBy: { type: mongoose.ObjectId, ref: 'User' },
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
user_id: { type: mongoose.ObjectId, ref: 'User' },
agent_id: { type: mongoose.ObjectId, ref: 'Representation' },
// form info
description: String,
createDate: String,
sendDate: String,
trackingCode: String,
items: [
{
// product info
ItemReceptionTransDate: String,
ItemName: String,
SerialNo1: String,
ItemID: String,
ItemCode: String,
// GStartDate: String,
// GEndDate: String,
gStatus: Boolean,
// piece info
pieceName: String,
pieceCode: String,
pieceQuantity: Number,
pieceId: { type: mongoose.ObjectId, ref: 'Piece' }
}
],
// admin operations
seen: { type: Boolean, default: false },
status: { type: String, enum: ['temp', 'sent', 'ongoing', 'waiting', 'delivered'], default: 'temp' },
statusHistory: [
{
status: String,
date: Number
}
],
deliveryCode: String
})
module.exports = mongoose.model('PieceRequest', PieceRequestSchema)
+111
View File
@@ -0,0 +1,111 @@
const mongoose = require('mongoose')
function file(file) {
return '/uploads/representation_docs/' + this.name
}
const FilesSchema = mongoose.Schema({
name: String
})
FilesSchema.virtual('url').get(file)
const RepresentationSchema = mongoose.Schema({
// user info
user_id: { type: mongoose.ObjectId, ref: 'User' },
representation_code: String,
agent_code: String,
editAccess: { type: Boolean, default: false },
// personal info
full_name: String,
birth_date: String,
id_number: String,
place_of_issue: String,
national_code: String,
fathers_name: String,
education_level: String,
military_status: String,
certificates: String,
// contact info
store_name: String,
province_name: String,
province_id: String,
city_name: String,
city_id: String,
postal_code: String,
mobile_number: String,
tel_number: String,
fax_number: String,
economic_code: String,
email: String,
address: String,
// location info
business_license: Boolean,
ownership_type: { type: String, enum: ['owner', 'rent', 'rghit_of_business'] },
total_area: String,
repair_area: String,
stock_area: String,
customer_reference_floor: String,
place_location: { type: String, enum: ['tech_passage', 'other'] },
geo_location: { type: String, enum: ['main_street', 'side_street', 'alley', 'inside_passage', 'outside_passage'] },
banner_info: String,
repair_technicians: String,
repair_masters: String,
office_workers: String,
bike_deliveries: String,
// experience info
computer_repair_exp: String,
multimedia_repair_exp: String,
business_exp: String,
// common questions
representation_type: {
type: String,
enum: ['verity', 'panatech', 'both'],
default: 'both'
},
know_asanServ_from: {
type: String,
enum: ['company_agents', 'website', 'company_workers', 'exhibition', 'introduced', 'other']
},
introducer_info: String,
asanServ_products_knowledge: { type: Number, enum: [0, 1, 2, 3, 4] },
computer_saling_exp: Boolean,
computer_saling_description: String,
other_representations: [
{
trademark: String,
company_name: String,
cooperation_history: String,
cooperation_start_year: String
}
],
more_descriptions: String,
// admins
status: {
type: String,
enum: ['registered', 'ongoing', 'verification', 'accepted', 'rejected'],
default: 'registered'
},
// files
upload: { type: Boolean, default: true },
tradeUnion: [FilesSchema],
expertise: [FilesSchema],
ownership: [FilesSchema],
repairShop: [FilesSchema],
itEmployee: [FilesSchema],
itExpert: [FilesSchema],
financialGuarantees: [FilesSchema],
//
archived: { type: Boolean, default: false },
_updatedBy: { type: mongoose.ObjectId, ref: 'User' },
_revoked: { type: Boolean, default: false },
_revokedBy: { type: mongoose.ObjectId, ref: 'User' }
})
module.exports = mongoose.model('Representation', RepresentationSchema)
+14
View File
@@ -0,0 +1,14 @@
const mongoose = require('mongoose')
const SMSBroadcastSchema = mongoose.Schema({
message: String,
recievers: [
{
user_id: { type: mongoose.ObjectId, ref: 'User' },
mobile_number: String
}
],
_creator: { type: mongoose.ObjectId, ref: 'User' }
})
module.exports = mongoose.model('SMSBroadcast', SMSBroadcastSchema)
+16
View File
@@ -0,0 +1,16 @@
const mongoose = require('mongoose')
const SurveySchema = mongoose.Schema({
purchasedProduct: { type: Number, enum: [1, 2, 3, 4, 5] },
guaranteeWorkFlow: { type: Number, enum: [1, 2, 3, 4, 5] },
employeeResponsibility: { type: Number, enum: [1, 2, 3, 4, 5] },
serviceQuality: { type: Number, enum: [1, 2, 3, 4, 5] },
serviceTime: { type: Number, enum: [1, 2, 3, 4, 5] },
repairQuality: { type: Number, enum: [1, 2, 3, 4, 5] },
coast: { type: Number, enum: [1, 2, 3, 4, 5] },
description: String,
code: String,
user: { type: mongoose.ObjectId, ref: 'User' },
})
module.exports = mongoose.model('Survey', SurveySchema)
+10
View File
@@ -0,0 +1,10 @@
const mongoose = require('mongoose')
const SurveyCheckSchema = mongoose.Schema({
code: String,
user: { type: mongoose.ObjectId, ref: 'User' },
smsSent: { type: Boolean, default: false },
timeAdded: Number // timestamp
})
module.exports = mongoose.model('SurveyCheck', SurveyCheckSchema)
+22
View File
@@ -0,0 +1,22 @@
const mongoose = require('mongoose')
function image(img) {
if (img) return '/uploads/images/tickets/' + img
}
const Ticket = mongoose.Schema({
message: String,
image: { type: String, get: image },
isUser: { type: Boolean, default: true },
read: { type: Boolean, default: false },
user_id: { type: mongoose.ObjectId, ref: 'User' }
})
const TicketConversation = mongoose.Schema({
title: String,
transaction_id: String,
user_id: { type: mongoose.ObjectId, ref: 'User' },
messages: [Ticket]
})
module.exports = mongoose.model('TicketConversation', TicketConversation)
+34
View File
@@ -0,0 +1,34 @@
const mongoose = require('mongoose')
const TransactionSchema = mongoose.Schema({
// system structure
user_id: { type: mongoose.ObjectId, ref: 'User' },
agent_id: { type: mongoose.ObjectId, ref: 'Representation' },
db_name: { type: String, enum: ['verity', 'panatech'] },
// form info
BusinessID: String,
Description: String,
cAddress1: String,
TransCCustom1: String,
cTel1: String,
items: Array,
//
TempReceiptTransNumber: String,
ItemReceptionTransNumber: String,
TempReceiptTransDate: String,
ItemReceptionTransDate: String,
// agent operations
seen: { type: Boolean, default: false },
status: { type: String, enum: ['saved', 'recieved', 'ongoing', 'waiting', 'delivered'], default: 'saved' },
statusHistory: [
{
status: String,
date: Number
}
],
deliveryCode: String
})
module.exports = mongoose.model('Transaction', TransactionSchema)
+10
View File
@@ -0,0 +1,10 @@
const mongoose = require('mongoose')
const TransactionDraftSchema = mongoose.Schema({
user_id: { type: mongoose.ObjectId, ref: 'User' },
db_name: { type: String, enum: ['verity', 'panatech'] },
description: String,
items: { type: Array, default: [] }
})
module.exports = mongoose.model('TransactionDraft', TransactionDraftSchema)
+59
View File
@@ -0,0 +1,59 @@
const mongoose = require('mongoose')
const UserSchema = mongoose.Schema({
// for admins
_creator: { type: mongoose.ObjectId, ref: 'User' },
private: { type: Boolean, default: false },
username: String,
permissions: Array,
// for user
national_code: String,
province_id: String,
city_id: String,
province_name: String,
city_name: String,
address: String,
postal_code: String,
tel_number: String,
mobile_number: String,
email: String,
store_name: String,
// verity info
verity_businessID: String,
verity_businessCode: String,
old_verity_businessID: String,
old_verity_businessCode: String,
// panatech info
panatech_businessID: String,
panatech_businessCode: String,
old_panatech_businessID: String,
old_panatech_businessCode: String,
isAgent: { type: Boolean, default: false },
representation_id: { type: mongoose.ObjectId, ref: 'Representation' },
representation_code: String,
askedForRepresentation: { type: Boolean, default: false },
// for both
first_name: String,
last_name: String,
password: String,
/// //////////////////////////////// user confirmations
confirmed: { type: Boolean, default: false },
email_confirmed: { type: Boolean, default: false },
mobile_confirmed: { type: Boolean, default: false },
emailConfirmationKey: String,
mobileConfirmationKey: String,
seenByAdmin: { type: Boolean, default: false },
/// /////////////
scope: { type: Array, default: ['user'] },
token: String,
appToken: String,
resetPassToken: String
})
module.exports = mongoose.model('User', UserSchema)
+17
View File
@@ -0,0 +1,17 @@
const mongoose = require('mongoose')
const paginate = require('mongoose-paginate-v2')
function image(img) {
return '/uploads/images/warrantyTerms/' + img
}
const WarrantySchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
title: String,
short_description: String,
description: String,
image: { type: String, get: image }
})
WarrantySchema.plugin(paginate)
module.exports = mongoose.model('Warranty', WarrantySchema)
+33
View File
@@ -0,0 +1,33 @@
const mongoose = require('mongoose')
const paginate = require('mongoose-paginate-v2')
function image(img) {
return '/uploads/images/downloads/' + img
}
function file(file) {
return '/uploads/apps/' + file
}
const DownloadFilesSchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
name: String,
os: {
type: String,
enum: ['windows', 'linux', 'mac', 'android', 'ios']
},
file: { type: String, get: file }
})
const DownloadSchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
title: String,
short_description: String,
description: String,
image: { type: String, get: image },
category: mongoose.ObjectId,
files: [DownloadFilesSchema]
})
DownloadSchema.plugin(paginate)
module.exports = mongoose.model('Download', DownloadSchema)
@@ -0,0 +1,8 @@
const mongoose = require('mongoose')
const DownloadCategorySchema = mongoose.Schema({
_creator: { type: mongoose.ObjectId, ref: 'User' },
name: String
})
module.exports = mongoose.model('DownloadCategory', DownloadCategorySchema)