-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathinit-data.js
More file actions
88 lines (83 loc) · 2.84 KB
/
init-data.js
File metadata and controls
88 lines (83 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const fs = require('fs');
const path = require('path');
// Create data directory if it doesn't exist
const dataDir = path.join(__dirname, 'data');
if (!fs.existsSync(dataDir)) {
fs.mkdirSync(dataDir, { recursive: true });
console.log('✅ Created data directory');
}
// Define all required data files with their initial structures
const dataFiles = {
'applications.json': [],
'application_drafts.json': [],
'archived_applications.json': [],
'application-types.json': [
{
id: '1',
name: 'Staff Application',
description: 'Apply to become a staff member',
cooldownDays: 14,
allowMultiplePending: false,
requireUniqueApproval: true,
fields: [
{ id: '1', label: 'Character Name', type: 'text', required: true, placeholder: 'Enter your character name' },
{ id: '2', label: 'Age', type: 'number', required: true, placeholder: 'Your age' },
{ id: '3', label: 'Steam ID', type: 'text', required: true, placeholder: 'steam:xxxxx' },
{ id: '4', label: 'Why do you want to be staff?', type: 'textarea', required: true, placeholder: 'Explain your motivation...' },
{ id: '5', label: 'Previous experience', type: 'textarea', required: true, placeholder: 'Describe your previous moderation/admin experience...' }
],
enabled: true,
createdAt: new Date().toISOString()
}
],
'tickets.json': [],
'bans.json': [],
'blacklist.json': [],
'notifications.json': [],
'announcements.json': [
{
id: '1',
title: 'Welcome to the Server!',
content: 'Welcome to our FiveM roleplay server. Please read the rules before applying.',
type: 'community',
priority: 'medium',
author: 'System',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
}
],
'rules.json': [
{
category: 'General Rules',
rules: [
'Be respectful to all players and staff',
'No metagaming or powergaming',
'Stay in character at all times',
'Follow staff instructions'
]
},
{
category: 'Roleplay Rules',
rules: [
'Value your life at all times',
'No Random Death Match (RDM)',
'No Vehicle Death Match (VDM)',
'Proper initiation before hostile actions'
]
}
],
'shop-products.json': [],
'activity_log.json': []
};
// Create each file if it doesn't exist
Object.entries(dataFiles).forEach(([filename, initialData]) => {
const filePath = path.join(dataDir, filename);
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, JSON.stringify(initialData, null, 2));
console.log(`✅ Created ${filename}`);
} else {
console.log(`⏭️ ${filename} already exists, skipping`);
}
});
console.log('\n🎉 Data initialization complete!');
console.log('📁 All required JSON files are ready in the /data directory');