1323 lines
22 KiB
JavaScript
1323 lines
22 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Categories = db.categories;
|
|
|
|
const Tags = db.tags;
|
|
|
|
const Sounds = db.sounds;
|
|
|
|
const Playlists = db.playlists;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const CategoriesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Transitions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Short FX used to move between scenes",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "transitions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"folder_path": "static/transitions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Reactions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Reaction sounds and short vocal cues",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "reactions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"folder_path": "static/reactions",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Meme Sounds",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Popular meme clips and comedic hits",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "meme_sounds",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"folder_path": "static/meme_sounds",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Ambience",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Background ambiences and atmospheric loops",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "ambience",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"folder_path": "static/ambience",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TagsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "funny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "funny",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#FFB300",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "dramatic",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "dramatic",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#D32F2F",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "loop",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "loop",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#1976D2",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "notification",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "notification",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#388E3C",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SoundsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Smooth Swipe",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"filename": "smooth_swipe.mp3",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration": 0.85,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"format": "WAV",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uploaded_at": new Date('2026-01-10T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2027-01-10T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plays": 124,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Audience Oooh",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"filename": "audience_ooh.wav",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration": 1.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"format": "OGG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uploaded_at": new Date('2026-01-12T12:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2020-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plays": 342,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Viral Meme Horn",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"filename": "viral_horn.mp3",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration": 0.6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"format": "WAV",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uploaded_at": new Date('2026-01-18T09:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2020-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plays": 980,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "City Night Loop",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"filename": "city_night_loop.ogg",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"duration": 120.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"format": "OGG",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"uploaded_at": new Date('2025-12-05T22:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2020-01-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"plays": 67,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PlaylistsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Stream Transitions Pack",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "A compact pack of transition FX for livestreams and edits",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"created_on": new Date('2026-01-15T10:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Ambient Evening",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Longform ambience suitable for background play",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"created_on": new Date('2025-12-06T08:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Alert Tones",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Short notification cues for apps and alerts",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"created_on": new Date('2026-01-02T09:30:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"title": "Meme Highlights",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Popular meme sounds and quick hits",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_public": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"created_on": new Date('2026-01-20T11:45:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSoundWithCategory() {
|
|
|
|
const relatedCategory0 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Sound0 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Sound0?.setCategory)
|
|
{
|
|
await
|
|
Sound0.
|
|
setCategory(relatedCategory0);
|
|
}
|
|
|
|
const relatedCategory1 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Sound1 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Sound1?.setCategory)
|
|
{
|
|
await
|
|
Sound1.
|
|
setCategory(relatedCategory1);
|
|
}
|
|
|
|
const relatedCategory2 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Sound2 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Sound2?.setCategory)
|
|
{
|
|
await
|
|
Sound2.
|
|
setCategory(relatedCategory2);
|
|
}
|
|
|
|
const relatedCategory3 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Sound3 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Sound3?.setCategory)
|
|
{
|
|
await
|
|
Sound3.
|
|
setCategory(relatedCategory3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateSoundWithUploaded_by() {
|
|
|
|
const relatedUploaded_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Sound0 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Sound0?.setUploaded_by)
|
|
{
|
|
await
|
|
Sound0.
|
|
setUploaded_by(relatedUploaded_by0);
|
|
}
|
|
|
|
const relatedUploaded_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Sound1 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Sound1?.setUploaded_by)
|
|
{
|
|
await
|
|
Sound1.
|
|
setUploaded_by(relatedUploaded_by1);
|
|
}
|
|
|
|
const relatedUploaded_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Sound2 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Sound2?.setUploaded_by)
|
|
{
|
|
await
|
|
Sound2.
|
|
setUploaded_by(relatedUploaded_by2);
|
|
}
|
|
|
|
const relatedUploaded_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Sound3 = await Sounds.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Sound3?.setUploaded_by)
|
|
{
|
|
await
|
|
Sound3.
|
|
setUploaded_by(relatedUploaded_by3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePlaylistWithOwner() {
|
|
|
|
const relatedOwner0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Playlist0 = await Playlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Playlist0?.setOwner)
|
|
{
|
|
await
|
|
Playlist0.
|
|
setOwner(relatedOwner0);
|
|
}
|
|
|
|
const relatedOwner1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Playlist1 = await Playlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Playlist1?.setOwner)
|
|
{
|
|
await
|
|
Playlist1.
|
|
setOwner(relatedOwner1);
|
|
}
|
|
|
|
const relatedOwner2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Playlist2 = await Playlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Playlist2?.setOwner)
|
|
{
|
|
await
|
|
Playlist2.
|
|
setOwner(relatedOwner2);
|
|
}
|
|
|
|
const relatedOwner3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Playlist3 = await Playlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Playlist3?.setOwner)
|
|
{
|
|
await
|
|
Playlist3.
|
|
setOwner(relatedOwner3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Categories.bulkCreate(CategoriesData);
|
|
|
|
|
|
|
|
|
|
await Tags.bulkCreate(TagsData);
|
|
|
|
|
|
|
|
|
|
await Sounds.bulkCreate(SoundsData);
|
|
|
|
|
|
|
|
|
|
await Playlists.bulkCreate(PlaylistsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSoundWithCategory(),
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateSoundWithUploaded_by(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePlaylistWithOwner(),
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('categories', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tags', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('sounds', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('playlists', null, {});
|
|
|
|
|
|
},
|
|
}; |