-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.sql
More file actions
182 lines (168 loc) · 15.2 KB
/
data.sql
File metadata and controls
182 lines (168 loc) · 15.2 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
-- passwords: peerpass, vsukhonospass,
-- veronikapass, jdoepass, superpass, dmalanpass, charliepass, lunapass, coderleopass, codequeenpass, codekingpass, friendpass
INSERT INTO users
(login, password, fullName, about, email, avatar, rating, role, registerDate, isConfirmed)
VALUES
('peer', '$2b$10$r2FrqdFlFVzRPTJk0LqgxOpWn55nqcUz39c8/c7e4wEvypvkLeI7u', NULL, 'Person who loves learning, solving programming problems and helping others do the same!', 'vsukhonos.test+peer@gmail.com', '/avatars/default.png', 0, 'admin', '2025-09-01 00:00:00', 1),
('vsukhonos', '$2b$10$GEBYxHBinMFAa4sjnlGnC.eWkZ0.0Y7U4Tp7MntkxNwEfa9gMl4cO', 'Veronika Sukhonos', 'Computer Science student at NTU "KhPI" :)', 'vsukhonos.test+vsukhonos@gmail.com', '/avatars/data-2.png', 0, 'admin', '2025-09-01 00:00:00', 1),
('ver0nika', '$2b$10$SeVTTA9ptDsFGBiFDR5wZepHXBbaBL9caW1BEvSBb0G97WpCD9dvC', 'Veronika Dev', 'Aspiring developer, passionate about learning how things work and building cool stuff with code.', 'vsukhonos.test+veronika@gmail.com', '/avatars/data-3.jpg', 0, 'user', '2025-09-02 10:20:00', 1),
('jdoe', '$2b$10$S6Y8mR4GByiwuyA4bba/7uLU8CxP//JTtukPwuELACj0kIkvevR6a', 'John Doe', 'Part-time debugger, full-time learner. I write code, break it, fix it, and sometimes even understand why it works.', 'jdoe@example.com', '/avatars/data-4.png', 0, 'user', '2025-09-05 15:15:00', 1),
('superman', '$2b$10$L1RvPxcMdzun45UJanPUcOHN3OK6RcrPpkwuCK8h10mTpxli4oCTS', 'Just Super', 'Decided to switch to IT', 'super@example.com', '/avatars/default.png', 0, 'user', '2025-09-09 12:01:00', 1),
('smalan', '$2b$10$zzZGSpcaTPMS3feLXa4UBuOjcEPvtgHG5CYAqMiMiIyjkK3436BHC', 'Sam Malan', 'Love problem-solving', 'smalan@example.com', '/avatars/default.png', 0, 'user', '2025-09-11 17:34:55', 1),
('charlie5', '$2b$10$gV8lVz1yx/1YGbN4icNWHOva/nnI.t8n3artcaNeCAzs2fCOLc4hu', 'Charlie Brown', 'Data Science Enthusiast', 'vsukhonos.test+charlie@gmail.com', '/avatars/default.png', 0, 'user', '2025-09-12 10:11:11', 1),
('luna', '$2b$10$ryg/9DPQd0yBlHrNrx5IcuYd/ZX7N1DBVk0WvAiEkek5jQf.bY4oa', 'Luna Park', 'Frontend explorer and UI enthusiast.', 'luna@example.com', '/avatars/default.png', 0, 'user', '2025-09-18 12:20:09', 1),
('ivybyte', '$2b$10$HT8fi0qL89hq/lSQQG1nm.mWPSzIMTfYRZ9MA7hrlXHouprUUi.Uq', 'Ivy Byte', 'Learning to code, one line and one bug at a time.', 'ivybyte@example.com', '/avatars/default.png', 0, 'user', '2025-09-27 10:05:50', 1),
('coderleo', '$2b$10$8Qlq298iolWMyMUBboO5pu69JL4DWYOwLzmQPWrZ0I.wdHzsFt4oC', 'Leo Smith', 'Backend dev who secretly loves CSS.', 'coderleo@example.com', '/avatars/default.png', 0, 'user', '2025-09-28 20:41:33', 1),
('codequeen', '$2b$10$hfkz9AhEjwDXys26ti.72ORIjgVfHF6HwPscO7OofwP7HjXCBLMoG', 'Code Queen', NULL, 'codequeen@example.com', '/avatars/default.png', 0, 'admin', '2025-10-04 14:23:11', 1),
('codeking', '$2b$10$Qakbna5QgoUZVYBUnXxj3OFr.GGGn3Ks5Tem26.QKEwT/de6SFEAK', 'Code King', NULL, 'codeking@example.com', '/avatars/data-12.jpg', 0, 'user', '2025-10-15 10:05:50', 1),
('friend', '$2b$10$UXKr.VrWeqh5o4rLikx3VO.lDNERsy0/qUBgu.JCw3Adl.UReEOZa', 'Friend the Developer', 'Code, friends, pizza.', 'friend@example.com', '/avatars/default.png', 0, 'user', '2025-10-24 11:41:33', 1),
('wizard', '$2b$10$UXKr.VrWeqh5o4rLikx3VO.lDNERsy0/qUBgu.JCw3Adl.UReEOZa', NULL, NULL, 'wizard@example.com', '/avatars/data-14.png', 0, 'user', '2025-10-26 20:41:33', 1);
INSERT INTO posts
(authorId, title, content, type, publishDate, updateDate, status)
VALUES
(3, 'What is the difference between REST and GraphQL?',
'<p>I have used REST APIs before, but I keep hearing about GraphQL. What are the pros and cons of each, and when should I use one over the other?</p>',
'problem', '2025-09-09 09:35:55', NULL, 'active'),
(1, 'How do I center a div in CSS?',
'<p>I have tried using <code>margin: auto</code>, flexbox and grid, but I am still confused about the best way to center a div both vertically and horizontally.</p>',
'problem', '2025-09-10 16:11:58', NULL, 'inactive'),
(7, 'How do I prevent SQL injection in Node.js?',
'<p>I am building an API with Node.js and Express.js. What are the best practices to prevent SQL injection when using a database like MySQL?</p>',
'problem', '2025-09-13 16:12:34', NULL, 'active'),
(3, 'Setting Up Environment Variables in a Node.js Project',
'<div>
<div>To manage environment variables in Node.js, create a <code>.env</code> file and use the <code>dotenv</code> package. Install it with <code>npm install dotenv</code>, then add require <code>(''dotenv'').config()</code> at the top of your entry file. Now you can access variables using <code>process.env.MY_VAR</code>. Never commit <code>.env</code> files to version control!</div>
</div>',
'solution', '2025-09-14 13:10:31', '2025-09-14 13:12:33', 'active'),
(5, 'What is the difference between a stack and a queue?',
'<p>I''m brushing up on data structures and a bit confused about stacks vs queues. I know they both hold items, but how do their insert/remove orders differ? Any quick example or real-world use case would help. Thanks!</p>',
'problem', '2025-09-15 11:10:43', NULL, 'active'),
(3, 'Mastering Layouts in CSS: Why Understanding Flexbox and Grid is a Game Changer',
'<p>I''ve styled plenty of web pages using basic CSS properties like <code>float</code>, <code>position</code>, and <code>inline-block</code>. But modern layout systems Flexbox and Grid have made it much easier to build responsive, maintainable and consistent layouts without resorting to workarounds.</p>
<p>Flexbox is most useful when you''re working in one dimension (either a row or a column). It''s perfect for things like nav bars, buttons, cards, and aligning content inside containers.</p>
<p>Grid, on the other hand, is built for two-dimensional layouts. It''s ideal for complex page structures like creating full sections, article layouts, dashboards or anything that needs rows and columns working together. Once you understand both systems, you can stop using outdated layout tricks and write CSS that is clean, effective and responsive.</p>',
'solution', '2025-09-18 00:15:57', NULL, 'inactive'),
(7, 'How to Use Async/Await with Fetch',
'<p>To use <code>async/await</code> with <code>fetch</code>, wrap it in a try/catch block:</p>
<pre class="language-javascript"><code>async function loadData() {
try {
const res = await fetch(''/api/data'')
const data = await res.json()
console.log(data)
} catch (err) {
console.error(''Fetch failed:'', err)
}
}</code></pre>',
'solution', '2025-09-16 17:48:48', NULL, 'inactive'),
(5, 'Threads and processes explained like I''m five',
'<p>I''m learning about concurrency in my OS class, and I can''t wrap my head around what makes a thread different from a process. Could someone break it down simply?</p>',
'problem', '2025-09-25 13:27:10', NULL, 'active'),
(11, 'Speeding Up Python Loops',
'<p>Instead of using regular <code>for</code> loops, try list comprehensions or vectorized operations with NumPy. They run much faster because they''re implemented in C under the hood.</p>',
'solution', '2025-10-05 09:47:32', NULL, 'active'),
(12, 'How to Fix "Module Not Found" in Node.js',
'<p>Double-check that the module is installed locally <code>npm install <package></code> and that you''re using the right import path. If it''s a global package, run with <code>npx</code>.</p>',
'solution', '2025-10-22 19:44:33', NULL, 'inactive'),
(13, 'Converting JSON to CSV in Python',
'<p>When working with data, you''ll often need to switch formats - for example, converting JSON files into CSV for analysis or import into Excel. Python makes this incredibly easy with the <code>pandas</code> library.</p>
<p>Start by installing pandas if you haven''t already:</p>
<code>pip install pandas</code>
<p>Then, with just a couple of lines, you can load a JSON file and export it as CSV:</p>
<pre class="language-python"><code>import pandas as pd
df = pd.read_json("data.json")
df.to_csv("output.csv", index=False)</code></pre>
<p>This automatically reads your JSON structure, converts it into a DataFrame, and writes it to a clean, well-formatted CSV file. You can even customize it - for example, selecting only specific columns or changing the delimiter.</p>
<p>That''s all it takes: two lines of code to transform JSON data into a ready-to-use CSV format. Perfect for data cleaning, reporting, or sharing datasets.</p>',
'solution', '2025-10-25 11:04:12', NULL, 'active'),
(14, 'REST API Returning 404 for Valid Endpoint',
'<p>I created a REST API using Express.js, but sometimes valid endpoints return 404 errors randomly. The routes are defined correctly, so I don''t understand why this happens. Could it be middleware or routing order?</p>',
'problem', '2025-10-26 11:30:22', NULL, 'inactive'),
(8, 'CSS Grid Not Aligning Properly',
'<p>I''m trying to create a two-column layout using CSS Grid, but the columns are not aligning as expected. I checked my grid-template-columns, but something seems off. What am I missing?</p>',
'problem', '2025-10-01 14:45:10', NULL, 'active');
INSERT INTO posts_images (postId, filename) VALUES
(2, '/posts/data-2.1.jpg'),
(2, '/posts/data-2.2.jpg'),
(6, '/posts/data-6.jpg'),
(11, '/posts/data-11.png');
INSERT INTO categories (title, description) VALUES
('graphql', 'Open-source query language for APIs and a server-side runtime.'),
('rest-api', 'API that conforms to the design principles of the representational state transfer (REST) architectural style, including uniform interface, client-server decoupling, statelessness, cacheability, layered system architecture.'),
('python', 'Interpreted, object-oriented, high-level programming language with dynamic semantics.'),
('web-development', 'Process of creating and maintaining websites and web applications, from designing the appearance to coding the functionality.'),
('css', 'Cascading Style Sheets (CSS) - stylesheet language used to describe the presentation of a document written in HTML or XML.
It is designed to enable the separation of content and presentation, including layout, colors, and fonts,
which can improve content accessibility, since the content can be written without concern for its presentation;
provide more flexibility and control in the specification of presentation characteristics;
enable multiple web pages to share formatting by specifying the relevant CSS in a separate .css file, which reduces complexity and repetition in the structural content;
and enable the .css file to be cached to improve the page load speed between the pages that share the file and its formatting.'),
('c#', NULL),
('node-js', 'Free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.'),
('sql', 'Structured Query Language (SQL) - standard language for storing, manipulating and retrieving data in databases.'),
('data-structures', NULL),
('dynamic-programming', NULL),
('docker', 'Docker - platform designed to help developers build, share, and run container applications.'),
('git', 'Git - distributed version control system that tracks changes in source code during software development and enables collaboration.'),
('cloud-computing', 'Paradigm for enabling network access to a scalable and elastic pool of shareable physical or virtual resources.'),
('next-js', NULL),
('mysql', 'Open-source relational database management system (RDBMS).'),
('json', NULL),
('ajax', NULL),
('javascript', 'High-level, dynamic, and interpreted programming language, primarily known for its role in making web pages interactive and dynamic, working alongside HTML (for structure) and CSS (for styling).'),
('operating-system', NULL);
INSERT INTO posts_categories (postId, categoryId) VALUES
(1, 1), (1, 2), (1, 4),
(2, 4), (2, 5),
(3, 8), (3, 2), (3, 7), (3, 15),
(4, 7),
(5, 9),
(6, 5), (6, 4),
(7, 4), (7, 18),
(8, 19),
(9, 3),
(10, 7),
(11, 3), (11, 16),
(12, 1), (12, 7),
(13, 5), (13, 4);
INSERT INTO posts_likes
(authorId, postId, type, publishDate)
VALUES
(1, 1, 'like', '2025-09-17 12:34:57'), (1, 2, 'dislike', '2025-09-17 12:35:59'), (1, 6, 'like', '2025-09-18 12:38:57'),
(2, 2, 'dislike', '2025-09-17 12:11:34'), (2, 3, 'like', '2025-09-21 23:35:57'),
(3, 1, 'like', '2025-09-17 12:57:57'), (3, 2, 'dislike', '2025-09-19 04:04:58'), (3, 4, 'like', '2025-09-25 16:38:57'),
(4, 4, 'like', '2025-09-25 17:38:57'), (4, 6, 'like', '2025-09-21 21:50:00'), (4, 7, 'like', '2025-09-21 21:34:10'),
(5, 2, 'dislike', '2025-09-17 19:05:27'), (5, 7, 'like', '2025-09-21 08:09:10'), (5, 6, 'like', '2025-09-23 12:40:11'),
(6, 1, 'like', '2025-09-17 12:34:58'), (6, 2, 'like', '2025-09-20 12:18:55'), (6, 5, 'like', '2025-09-24 20:40:31'),
(7, 2, 'dislike', '2025-09-18 19:20:21'), (7, 6, 'like', '2025-09-26 00:00:00'),
(1, 11, 'thank', '2025-10-26 19:20:21'), (9, 11, 'dislike', '2025-10-25 19:20:21'), (2, 11, 'like', '2025-10-26 09:33:21'),
(3, 11, 'like', '2025-10-25 18:15:22'), (4, 11, 'like', '2025-10-25 19:20:22'), (11, 11, 'like', '2025-10-26 08:15:47');
INSERT INTO favorite_posts
(userId, postId, addDate, isNotified)
VALUES
(1, 6, '2025-09-18 09:21:17', 0),
(1, 7, '2025-09-18 23:22:18', 0),
(7, 6, '2025-09-20 00:13:23', 0),
(7, 7, '2025-09-18 10:27:54', 0),
(7, 1, '2025-09-21 21:21:21', 0),
(1, 11, '2025-10-26 23:22:18', 0);
INSERT INTO comments
(authorId, postId, parentId, content,
publishDate, updateDate, status, pinDate)
VALUES
(1, 6, NULL, 'Thanks for sharing!', '2025-09-18 00:21:17', NULL, 'active', '2025-09-18 00:22:07'),
(2, 6, 1, 'In my opinion, this information can be found anywhere, not really interesting', '2025-09-18 12:23:23', NULL, 'inactive', NULL),
(2, 6, 2, 'I have changed my mind.', '2025-09-19 12:23:23', NULL, 'inactive', NULL),
(5, 6, NULL, 'Good, planning to learn them next weekend', '2025-09-18 06:21:17', NULL, 'active', NULL),
(6, 1, NULL, 'REST and GraphQL are both API design approaches, but they differ in flexibility and structure. REST uses fixed endpoints for each resource (e.g., /users, /posts), often leading to over-fetching or under-fetching of data. In contrast, GraphQL allows clients to request exactly the data they need in a single query, reducing unnecessary data transfer, which makes it more efficient for complex or evolving frontends, especially in mobile apps. However, REST is simpler, widely adopted, and often easier to cache.
So, use REST for straightforward, well-defined APIs, and consider GraphQL when you need flexibility, reduced payloads, or efficient interactions with complex data.', '2025-09-15 17:16:15', NULL, 'active', NULL),
(1, 5, NULL, 'A stack uses LIFO (last in, first out) - the last item added is the first one removed, like a stack of plates. A queue uses FIFO (first in, first out) — the first item added is the first removed, like a line at a store.', '2025-09-17 11:43:11', NULL, 'active', '2025-09-18 09:15:07'),
(1, 11, NULL, 'Awesome, thank you, friend!', '2025-10-26 11:49:17', NULL, 'active', '2025-10-26 15:15:07'),
(13, 11, 7, 'You are welcome!', '2025-10-26 15:16:01', NULL, 'active', NULL);
INSERT INTO comments_likes
(authorId, commentId, type, publishDate)
VALUES
(1, 2, 'dislike', '2025-09-18 12:34:57'), (1, 4, 'like', '2025-09-17 16:05:00'), (1, 5, 'like', '2025-09-18 16:06:01'),
(2, 5, 'like', '2025-09-16 11:15:11'), (2, 6, 'like', '2025-09-28 12:19:01'),
(3, 1, 'like', '2025-09-22 22:22:22'), (3, 2, 'dislike', '2025-09-21 21:21:21'), (3, 3, 'like', '2025-09-23 23:23:23'),
(7, 1, 'like', '2025-09-24 14:18:16'),
(13, 7, 'like', '2025-10-26 15:16:01');