refactor: restructure API routes from v1/v2/v3 to domain-based (skydive/cms/herowars)

This commit is contained in:
2026-04-24 00:47:58 +02:00
parent b99842f458
commit 9f73ed07ba
36 changed files with 2416 additions and 50 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ var AeronefSchema = new mongoose.Schema({
slug: { type: String, lowercase: true, unique: true },
aeronef: String,
imat: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
AeronefSchema.pre('validate', function (next) {
+1 -1
View File
@@ -8,7 +8,7 @@ var ApplicationSchema = new mongoose.Schema({
slug: { type: String, lowercase: true, unique: true },
title: String,
description: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, { timestamps: true, toJSON: { virtuals: true } });
ApplicationSchema.plugin(uniqueValidator, { message: 'is already taken' });
+1 -1
View File
@@ -12,7 +12,7 @@ var ArticleSchema = new mongoose.Schema({
membre: String,
// membre: Membre.schema,
// membre: { type: mongoose.Schema.Types.ObjectId, ref: 'Membre' },
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
author: { type: mongoose.Schema.Types.UUID, ref: 'User' },
comments: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Comment' }],
favoritesCount: { type: Number, default: 0 },
tagList: [{ type: String }]
+1 -1
View File
@@ -5,7 +5,7 @@ var CanopySchema = new mongoose.Schema({
slug: { type: String, lowercase: true, unique: true },
voile: String,
taille: Number,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
CanopySchema.pre('validate', function (next) {
+1 -1
View File
@@ -2,7 +2,7 @@ var mongoose = require('mongoose');
var CommentSchema = new mongoose.Schema({
body: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
author: { type: mongoose.Schema.Types.UUID, ref: 'User' },
article: { type: mongoose.Schema.Types.ObjectId, ref: 'Article' }
}, { timestamps: true, toJSON: { virtuals: true } });
+1 -1
View File
@@ -5,7 +5,7 @@ var DropzoneSchema = new mongoose.Schema({
slug: { type: String, lowercase: true, unique: true },
lieu: String,
oaci: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
DropzoneSchema.pre('validate', function (next) {
+1 -1
View File
@@ -25,7 +25,7 @@ var JumpSchema = new mongoose.Schema({
video: String,
files: [{ type: mongoose.Schema.Types.ObjectId, ref: 'JumpFile' }],
x2data: { type: mongoose.Schema.Types.ObjectId, ref: 'X2DataLog' },
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
JumpSchema.plugin(uniqueValidator, { message: 'is already taken' });
+1 -1
View File
@@ -11,7 +11,7 @@ var JumpFileSchema = new mongoose.Schema({
enum : ['csv', 'image', 'kml', 'video'],
default: 'video'
},
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
JumpFileSchema.plugin(uniqueValidator, { message: 'is already taken' });
+4 -1
View File
@@ -1,10 +1,13 @@
var mongoose = require('mongoose');
var uniqueValidator = require('mongoose-unique-validator');
var crypto = require('crypto');
const { v4: uuidv4 } = require('uuid');
var jwt = require('jsonwebtoken'),
config = require('../../../config');
var UserSchema = new mongoose.Schema({
//_id: { type: String, default: uuidv4() },
_id: { type: mongoose.Schema.Types.UUID },
email: { type: String, lowercase: true, unique: true, required: [true, "email can't be blank"], match: [/\S+@\S+\.\S+/, 'is invalid'], index: true },
username: { type: String, lowercase: true, unique: true, required: [true, "username can't be blank"], match: [/^[a-zA-Z0-9_]+$/, 'is invalid'], index: true },
role: String,
@@ -16,7 +19,7 @@ var UserSchema = new mongoose.Schema({
image: String,
bg_image: String,
favorites: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Product' }],
following: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }],
following: [{ type: mongoose.Schema.Types.UUID, ref: 'User' }],
hash: String,
salt: String
}, { timestamps: true, toJSON: { virtuals: true } });
+1 -1
View File
@@ -60,7 +60,7 @@ var X2DataLogSchema = new mongoose.Schema({
],
date: String,
createdOn: String,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
X2DataLogSchema.methods.toJSONFor = function() {
+1 -1
View File
@@ -47,7 +47,7 @@ var HWMemberSchemaOld = new mongoose.Schema({
scoreGifts: Number,
warGifts: Number,
rewards: Number,
author: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
author: { type: mongoose.Schema.Types.UUID, ref: 'User' }
}, {timestamps: true, toJSON: {virtuals: true}});
*/
var HWMemberSchema = new mongoose.Schema({