mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
move models to shared lib DbModels
This commit is contained in:
parent
618e3c88e1
commit
b98697a2d0
@ -14,7 +14,8 @@
|
||||
"RedisClient": "src/shared-classes",
|
||||
"StorageClient": "src/shared-classes",
|
||||
"DbManager": "src/shared-classes",
|
||||
"Errors": "src/shared-classes"
|
||||
"Errors": "src/shared-classes",
|
||||
"DbModels": "src/shared-classes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -14,7 +14,8 @@
|
||||
"RedisClient": "src/shared-classes",
|
||||
"StorageClient": "src/shared-classes",
|
||||
"DbManager": "src/shared-classes",
|
||||
"Errors": "src/shared-classes"
|
||||
"Errors": "src/shared-classes",
|
||||
"DbModels": "src/shared-classes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -14,7 +14,8 @@
|
||||
"RedisClient": "src/shared-classes",
|
||||
"StorageClient": "src/shared-classes",
|
||||
"DbManager": "src/shared-classes",
|
||||
"Errors": "src/shared-classes"
|
||||
"Errors": "src/shared-classes",
|
||||
"DbModels": "src/shared-classes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
import getWidgetCode from "@utils/getWidgetCode"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (req, res) => {
|
||||
const widget_id = req.params.widgetId
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (req, res) => {
|
||||
let { limit = 20, offset = 0, keywords } = req.query
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (req, res) => {
|
||||
const { user_id } = req.params
|
||||
|
@ -5,7 +5,7 @@ import path from "path"
|
||||
|
||||
import syncFolder from "@utils/syncDirToRemote"
|
||||
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
|
||||
const tmpPath = path.join(process.cwd(), ".tmp")
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Widget } from "@models"
|
||||
import { Widget } from "@shared-classes/DbModels"
|
||||
import compileWidgetCode from "@utils/compileWidgetCode"
|
||||
import path from "path"
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
"RedisClient": "src/shared-classes",
|
||||
"StorageClient": "src/shared-classes",
|
||||
"DbManager": "src/shared-classes",
|
||||
"Errors": "src/shared-classes"
|
||||
"Errors": "src/shared-classes",
|
||||
"DbModels": "src/shared-classes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
import getEnhancedLyricsFromTrack from "@services/getEnhancedLyricsFromTrack"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, Track } from "@models"
|
||||
import { Playlist, Track } from "@shared-classes/DbModels"
|
||||
import { AuthorizationError, PermissionError, NotFoundError } from "@shared-classes/Errors"
|
||||
import RemoveTracks from "@services/removeTracks"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, TrackLike, Track } from "@models"
|
||||
import { Playlist, TrackLike, Track } from "@shared-classes/DbModels"
|
||||
import { NotFoundError } from "@shared-classes/Errors"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, Track } from "@models"
|
||||
import { Playlist, Track } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (req, res) => {
|
||||
const { keywords, limit = 5, offset = 0 } = req.query
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, Track } from "@models"
|
||||
import { Playlist, Track } from "@shared-classes/DbModels"
|
||||
import { AuthorizationError, NotFoundError } from "@shared-classes/Errors"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, Track } from "@models"
|
||||
import { Playlist, Track } from "@shared-classes/DbModels"
|
||||
import { AuthorizationError, NotFoundError, PermissionError, BadRequestError } from "@shared-classes/Errors"
|
||||
import axios from "axios"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (_id) => {
|
||||
if (!_id) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
import { NotFoundError } from "@shared-classes/Errors"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
import { NotFoundError, InternalServerError } from "@shared-classes/Errors"
|
||||
|
||||
import mimetypes from "mime-types"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (req, res) => {
|
||||
const { ids, limit = 20, offset = 0 } = req.query
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
import { NotFoundError } from "@shared-classes/Errors"
|
||||
import getEnhancedLyricsFromTrack from "@services/getEnhancedLyricsFromTrack"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { TrackLike, Track } from "@models"
|
||||
import { TrackLike, Track } from "@shared-classes/DbModels"
|
||||
import { AuthorizationError, NotFoundError } from "@shared-classes/Errors"
|
||||
|
||||
export default async (req, res) => {
|
||||
|
@ -1,19 +0,0 @@
|
||||
import mongoose, { Schema } from "mongoose"
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
function generateModels() {
|
||||
let models = {}
|
||||
|
||||
const dirs = fs.readdirSync(__dirname).filter(file => file !== "index.js")
|
||||
|
||||
dirs.forEach((file) => {
|
||||
const model = require(path.join(__dirname, file)).default
|
||||
|
||||
models[model.name] = mongoose.model(model.name, new Schema(model.schema), model.collection)
|
||||
})
|
||||
|
||||
return models
|
||||
}
|
||||
|
||||
module.exports = generateModels()
|
@ -1,5 +1,5 @@
|
||||
import findSpotifyId from "@services/findSpotifyId"
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
import axios from "axios"
|
||||
|
||||
const syncLyricsProvider = `https://spotify-lyric-api.herokuapp.com`
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Track } from "@models"
|
||||
import { Track } from "@shared-classes/DbModels"
|
||||
|
||||
const urlRegex = new RegExp(`^https://(.*?)/(.*)$`)
|
||||
|
||||
|
@ -14,7 +14,8 @@
|
||||
"RedisClient": "src/shared-classes",
|
||||
"StorageClient": "src/shared-classes",
|
||||
"DbManager": "src/shared-classes",
|
||||
"Errors": "src/shared-classes"
|
||||
"Errors": "src/shared-classes",
|
||||
"DbModels": "src/shared-classes"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -52,7 +53,7 @@
|
||||
"music-metadata": "^8.1.3",
|
||||
"normalize-url": "^8.0.0",
|
||||
"nsfwjs": "2.4.2",
|
||||
"p-map": "^6.0.0",
|
||||
"p-map": "4",
|
||||
"p-queue": "^7.3.4",
|
||||
"passport": "^0.6.0",
|
||||
"passport-jwt": "^4.0.1",
|
||||
@ -68,4 +69,4 @@
|
||||
"mocha": "^10.2.0",
|
||||
"nodemon": "^2.0.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import passport from "passport"
|
||||
import jwt from "jsonwebtoken"
|
||||
import EventEmitter from "@foxify/events"
|
||||
|
||||
import { User, Session, Config } from "@models"
|
||||
import { User, Session, Config } from "@shared-classes/DbModels"
|
||||
|
||||
import DbManager from "@classes/DbManager"
|
||||
import { createStorageClientInstance } from "@classes/StorageClient"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
import bcrypt from "bcrypt"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Session } from "@models"
|
||||
import { Session } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
import Avatars from "dicebar_lib"
|
||||
import bcrypt from "bcrypt"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Badge } from "@models"
|
||||
import { Badge } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "DELETE",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { Badge } from "@models"
|
||||
import { Badge } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, Badge } from "@models"
|
||||
import { User, Badge } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Badge, User } from "@models"
|
||||
import { Badge, User } from "@shared-classes/DbModels"
|
||||
import { Schematized } from "@lib"
|
||||
|
||||
export default {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Badge } from "@models"
|
||||
import { Badge } from "@shared-classes/DbModels"
|
||||
import { Schematized } from "@lib"
|
||||
|
||||
export default {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { Badge, User } from "@models"
|
||||
import { Badge, User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "DELETE",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Comment } from "../../../models"
|
||||
import { Comment } from "@shared-classes/DbModels"
|
||||
import CheckUserAdmin from "../../../lib/checkUserAdmin"
|
||||
|
||||
export default async (payload) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, Comment } from "../../../models"
|
||||
import { User, Comment } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload = {}) => {
|
||||
const { parent_id } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, Comment } from "../../../models"
|
||||
import { User, Comment } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
const { parent_id, message, user_id } = payload
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Controller } from "linebridge/dist/server"
|
||||
|
||||
import { FeaturedEvent } from "@models"
|
||||
import { FeaturedEvent } from "@shared-classes/DbModels"
|
||||
import createFeaturedEvent from "./services/createFeaturedEvent"
|
||||
|
||||
// TODO: Migrate to new linebridge 0.15 endpoint classes instead of this
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FeaturedEvent } from "../../../models"
|
||||
import { FeaturedEvent } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist, User, UserFollow } from "@models"
|
||||
import { Playlist, User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Playlist } from "@models"
|
||||
import { Playlist } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post, UserFollow } from "@models"
|
||||
import { Post, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
import fullfillPostsData from "@utils/fullfillPostsData"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { UserFollow } from "@models"
|
||||
import { UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, UserFollow } from "@models"
|
||||
import { User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { User, UserFollow } from "@models"
|
||||
import { User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
import followUser from "../services/followUser"
|
||||
import unfollowUser from "../services/unfollowUser"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, UserFollow } from "@models"
|
||||
import { User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
if (typeof payload.user_id === "undefined") {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, UserFollow } from "@models"
|
||||
import { User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
if (typeof payload.user_id === "undefined") {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post, } from "@models"
|
||||
import { Post, } from "@shared-classes/DbModels"
|
||||
import toggleLike from "../../PostsController/services/toggleLike"
|
||||
|
||||
export default {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, NFCTag } from "@models"
|
||||
import { User, NFCTag } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, NFCTag } from "@models"
|
||||
import { User, NFCTag } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NFCTag } from "@models"
|
||||
import { NFCTag } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NFCTag } from "@models"
|
||||
import { NFCTag } from "@shared-classes/DbModels"
|
||||
|
||||
const allowedUpdateFields = [
|
||||
"user_id",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import momentTimezone from "moment-timezone"
|
||||
import { Post } from "@models"
|
||||
import { Post } from "@shared-classes/DbModels"
|
||||
|
||||
import getPostData from "./getPostData"
|
||||
import flagNsfwByAttachments from "./flagNsfwByAttachments"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post, User } from "../../../models"
|
||||
import { Post, User } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
const { post_id, by_user_id } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post } from "../../../models"
|
||||
import { Post } from "@shared-classes/DbModels"
|
||||
import indecentPrediction from "../../../utils/indecent-prediction"
|
||||
import isNSFW from "../../../utils/is-nsfw"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post, SavedPost } from "@models"
|
||||
import { Post, SavedPost } from "@shared-classes/DbModels"
|
||||
import fullfillPostsData from "@utils/fullfillPostsData"
|
||||
|
||||
export default async (payload) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post } from "@models"
|
||||
import { Post } from "@shared-classes/DbModels"
|
||||
import getPostData from "./getPostData"
|
||||
|
||||
export default async (post_id, modification) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PostLike } from "@models"
|
||||
import { PostLike } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
let { post_id, user_id, to } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SavedPost } from "../../../models"
|
||||
import { SavedPost } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
let { post_id, user_id } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FeaturedWallpaper } from "../../../models"
|
||||
import { FeaturedWallpaper } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ServerLimit } from "@models"
|
||||
import { ServerLimit } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { FeaturedWallpaper } from "@models"
|
||||
import { FeaturedWallpaper } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Controller } from "linebridge/dist/server"
|
||||
import { Role, User } from "@models"
|
||||
import { Role, User } from "@shared-classes/DbModels"
|
||||
import { Schematized } from "@lib"
|
||||
|
||||
export default class RolesController extends Controller {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { User } from "@models"
|
||||
import { User, Playlist, Track } from "@shared-classes/DbModels"
|
||||
import pmap from "p-map"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
@ -9,19 +10,60 @@ export default {
|
||||
|
||||
let suggestions = {}
|
||||
|
||||
// search users by username or name
|
||||
const users = await User.find({
|
||||
$or: [
|
||||
{ username: { $regex: keywords, $options: "i" } },
|
||||
{ fullName: { $regex: keywords, $options: "i" } },
|
||||
],
|
||||
})
|
||||
.limit(5)
|
||||
.select("username fullName avatar verified")
|
||||
const searchers = [
|
||||
{
|
||||
id: "users",
|
||||
model: User,
|
||||
query: {
|
||||
$or: [
|
||||
{ username: { $regex: keywords, $options: "i" } },
|
||||
{ fullName: { $regex: keywords, $options: "i" } },
|
||||
]
|
||||
},
|
||||
limit: 5,
|
||||
select: "username fullName avatar verified",
|
||||
},
|
||||
{
|
||||
id: "playlists",
|
||||
model: Playlist,
|
||||
query: {
|
||||
$or: [
|
||||
{ title: { $regex: keywords, $options: "i" } },
|
||||
]
|
||||
},
|
||||
limit: 5,
|
||||
},
|
||||
{
|
||||
id: "tracks",
|
||||
model: Track,
|
||||
query: {
|
||||
$or: [
|
||||
{ title: { $regex: keywords, $options: "i" } },
|
||||
{ author: { $regex: keywords, $options: "i" } },
|
||||
{ album: { $regex: keywords, $options: "i" } },
|
||||
]
|
||||
},
|
||||
limit: 5,
|
||||
}
|
||||
]
|
||||
|
||||
if (users.length > 0) {
|
||||
suggestions["users"] = users
|
||||
}
|
||||
await pmap(
|
||||
searchers,
|
||||
async (searcher) => {
|
||||
let results = await searcher.model.find(searcher.query)
|
||||
.limit(searcher.limit ?? 5)
|
||||
.select(searcher.select ?? undefined)
|
||||
|
||||
if (results.length > 0) {
|
||||
suggestions[searcher.id] = results
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
{
|
||||
concurrency: 3
|
||||
}
|
||||
)
|
||||
|
||||
return res.json(suggestions)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Session } from "@models"
|
||||
import { Session } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "DELETE",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Session } from "@models"
|
||||
import { Session } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,6 +1,6 @@
|
||||
import jwt from "jsonwebtoken"
|
||||
|
||||
import { Session } from "@models"
|
||||
import { Session } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { UserFollow } from "@models"
|
||||
import { UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload = {}) => {
|
||||
const { from_user_id } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "DELETE",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingCategory } from "@models"
|
||||
import { StreamingCategory } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
import NewStreamingProfile from "@services/newStreamingProfile"
|
||||
import composeStreamingSources from "@utils/compose-streaming-sources"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile, User } from "@models"
|
||||
import { StreamingProfile, User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
import NewStreamingProfile from "@services/newStreamingProfile"
|
||||
|
||||
export default {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamingProfile } from "@models"
|
||||
import { StreamingProfile } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "POST",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SyncEntry } from "../../../models"
|
||||
import { SyncEntry } from "@shared-classes/DbModels"
|
||||
|
||||
import crypto from "crypto"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import lodash from "lodash"
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
const publicGetters = [
|
||||
"_id",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default {
|
||||
method: "GET",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
import UpdateUserData from "../services/updateUserData"
|
||||
|
||||
const AllowedPublicUpdateFields = [
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Schematized } from "@lib"
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
import updateUserPassword from "../services/updateUserPassword"
|
||||
import bcrypt from "bcrypt"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
import Avatars from "dicebar_lib"
|
||||
import bcrypt from "bcrypt"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { UserFollow } from "@models"
|
||||
import { UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload = {}) => {
|
||||
const { from_user_id } = payload
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (payload) => {
|
||||
if (typeof payload.user_id === "undefined") {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "@models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
import bcrypt from "bcrypt"
|
||||
|
||||
export default async function (payload) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { UserFollow } from "../models"
|
||||
import { UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (user_id) => {
|
||||
// get followers of the user
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User, UserFollow } from "@models"
|
||||
import { User, UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async function (userData) {
|
||||
//
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { UserFollow } from "../models"
|
||||
import { UserFollow } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (user_id) => {
|
||||
// get followers of the user
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post } from "../models"
|
||||
import { Post } from "@shared-classes/DbModels"
|
||||
import DBManager from "../classes/DbManager"
|
||||
|
||||
async function main() {
|
||||
|
@ -3,7 +3,7 @@ require("dotenv").config()
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
import { Post, PostLike } from "../models"
|
||||
import { Post, PostLike } from "@shared-classes/DbModels"
|
||||
import { performance } from "perf_hooks"
|
||||
import DBManager from "../classes/DbManager"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { User } from "../../models"
|
||||
import { User } from "@shared-classes/DbModels"
|
||||
|
||||
export default async (user_id) => {
|
||||
if (!user_id) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import jwt from "jsonwebtoken"
|
||||
import { Session, RegenerationToken } from "@models"
|
||||
import { Session, RegenerationToken } from "@shared-classes/DbModels"
|
||||
|
||||
export async function regenerateSession(expiredToken, refreshToken, aggregateData = {}) {
|
||||
// search for a regeneration token with the expired token (Should exist only one)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Config } from "../../models"
|
||||
import { Config } from "@shared-classes/DbModels"
|
||||
|
||||
export default (req, res, next) => {
|
||||
const requestedPath = `${req.method.toLowerCase()}${req.path.toLowerCase()}`
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Session, User, authorizedServerTokens } from "@models"
|
||||
import { Session, User, authorizedServerTokens } from "@shared-classes/DbModels"
|
||||
import { Token } from "@lib"
|
||||
|
||||
import SecureEntry from "@lib/secureEntry"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user