@armoyu/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/dist/api/ApiClient.d.ts +16 -0
  2. package/dist/api/ApiClient.d.ts.map +1 -0
  3. package/dist/api/ApiClient.js +50 -0
  4. package/dist/api/ApiClient.js.map +1 -0
  5. package/dist/index.d.ts +18 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +25 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/models/auth/Role.d.ts +14 -0
  10. package/dist/models/auth/Role.d.ts.map +1 -0
  11. package/dist/models/auth/Role.js +28 -0
  12. package/dist/models/auth/Role.js.map +1 -0
  13. package/dist/models/auth/Session.d.ts +23 -0
  14. package/dist/models/auth/Session.d.ts.map +1 -0
  15. package/dist/models/auth/Session.js +43 -0
  16. package/dist/models/auth/Session.js.map +1 -0
  17. package/dist/models/auth/User.d.ts +52 -0
  18. package/dist/models/auth/User.d.ts.map +1 -0
  19. package/dist/models/auth/User.js +98 -0
  20. package/dist/models/auth/User.js.map +1 -0
  21. package/dist/models/community/Classroom.d.ts +18 -0
  22. package/dist/models/community/Classroom.d.ts.map +1 -0
  23. package/dist/models/community/Classroom.js +35 -0
  24. package/dist/models/community/Classroom.js.map +1 -0
  25. package/dist/models/community/Event.d.ts +26 -0
  26. package/dist/models/community/Event.d.ts.map +1 -0
  27. package/dist/models/community/Event.js +34 -0
  28. package/dist/models/community/Event.js.map +1 -0
  29. package/dist/models/community/Faculty.d.ts +16 -0
  30. package/dist/models/community/Faculty.d.ts.map +1 -0
  31. package/dist/models/community/Faculty.js +31 -0
  32. package/dist/models/community/Faculty.js.map +1 -0
  33. package/dist/models/community/Forum.d.ts +25 -0
  34. package/dist/models/community/Forum.d.ts.map +1 -0
  35. package/dist/models/community/Forum.js +37 -0
  36. package/dist/models/community/Forum.js.map +1 -0
  37. package/dist/models/community/Giveaway.d.ts +21 -0
  38. package/dist/models/community/Giveaway.d.ts.map +1 -0
  39. package/dist/models/community/Giveaway.js +40 -0
  40. package/dist/models/community/Giveaway.js.map +1 -0
  41. package/dist/models/community/Group.d.ts +37 -0
  42. package/dist/models/community/Group.d.ts.map +1 -0
  43. package/dist/models/community/Group.js +77 -0
  44. package/dist/models/community/Group.js.map +1 -0
  45. package/dist/models/community/School.d.ts +27 -0
  46. package/dist/models/community/School.d.ts.map +1 -0
  47. package/dist/models/community/School.js +50 -0
  48. package/dist/models/community/School.js.map +1 -0
  49. package/dist/models/community/SchoolTeam.d.ts +26 -0
  50. package/dist/models/community/SchoolTeam.d.ts.map +1 -0
  51. package/dist/models/community/SchoolTeam.js +43 -0
  52. package/dist/models/community/SchoolTeam.js.map +1 -0
  53. package/dist/models/community/Station.d.ts +68 -0
  54. package/dist/models/community/Station.d.ts.map +1 -0
  55. package/dist/models/community/Station.js +130 -0
  56. package/dist/models/community/Station.js.map +1 -0
  57. package/dist/models/community/Survey.d.ts +26 -0
  58. package/dist/models/community/Survey.d.ts.map +1 -0
  59. package/dist/models/community/Survey.js +53 -0
  60. package/dist/models/community/Survey.js.map +1 -0
  61. package/dist/models/community/SurveyAnswer.d.ts +14 -0
  62. package/dist/models/community/SurveyAnswer.d.ts.map +1 -0
  63. package/dist/models/community/SurveyAnswer.js +28 -0
  64. package/dist/models/community/SurveyAnswer.js.map +1 -0
  65. package/dist/models/community/Team.d.ts +12 -0
  66. package/dist/models/community/Team.d.ts.map +1 -0
  67. package/dist/models/community/Team.js +26 -0
  68. package/dist/models/community/Team.js.map +1 -0
  69. package/dist/models/community/Workplace.d.ts +17 -0
  70. package/dist/models/community/Workplace.d.ts.map +1 -0
  71. package/dist/models/community/Workplace.js +34 -0
  72. package/dist/models/community/Workplace.js.map +1 -0
  73. package/dist/models/content/Game.d.ts +18 -0
  74. package/dist/models/content/Game.d.ts.map +1 -0
  75. package/dist/models/content/Game.js +41 -0
  76. package/dist/models/content/Game.js.map +1 -0
  77. package/dist/models/content/Media.d.ts +16 -0
  78. package/dist/models/content/Media.d.ts.map +1 -0
  79. package/dist/models/content/Media.js +32 -0
  80. package/dist/models/content/Media.js.map +1 -0
  81. package/dist/models/content/Mod.d.ts +20 -0
  82. package/dist/models/content/Mod.d.ts.map +1 -0
  83. package/dist/models/content/Mod.js +39 -0
  84. package/dist/models/content/Mod.js.map +1 -0
  85. package/dist/models/content/News.d.ts +23 -0
  86. package/dist/models/content/News.d.ts.map +1 -0
  87. package/dist/models/content/News.js +43 -0
  88. package/dist/models/content/News.js.map +1 -0
  89. package/dist/models/content/Project.d.ts +26 -0
  90. package/dist/models/content/Project.d.ts.map +1 -0
  91. package/dist/models/content/Project.js +45 -0
  92. package/dist/models/content/Project.js.map +1 -0
  93. package/dist/models/core/PlatformStats.d.ts +41 -0
  94. package/dist/models/core/PlatformStats.d.ts.map +1 -0
  95. package/dist/models/core/PlatformStats.js +61 -0
  96. package/dist/models/core/PlatformStats.js.map +1 -0
  97. package/dist/models/core/SystemSettings.d.ts +33 -0
  98. package/dist/models/core/SystemSettings.d.ts.map +1 -0
  99. package/dist/models/core/SystemSettings.js +42 -0
  100. package/dist/models/core/SystemSettings.js.map +1 -0
  101. package/dist/models/index.d.ts +37 -0
  102. package/dist/models/index.d.ts.map +1 -0
  103. package/dist/models/index.js +53 -0
  104. package/dist/models/index.js.map +1 -0
  105. package/dist/models/shop/CartItem.d.ts +13 -0
  106. package/dist/models/shop/CartItem.d.ts.map +1 -0
  107. package/dist/models/shop/CartItem.js +27 -0
  108. package/dist/models/shop/CartItem.js.map +1 -0
  109. package/dist/models/shop/Order.d.ts +19 -0
  110. package/dist/models/shop/Order.d.ts.map +1 -0
  111. package/dist/models/shop/Order.js +40 -0
  112. package/dist/models/shop/Order.js.map +1 -0
  113. package/dist/models/shop/Product.d.ts +19 -0
  114. package/dist/models/shop/Product.d.ts.map +1 -0
  115. package/dist/models/shop/Product.js +52 -0
  116. package/dist/models/shop/Product.js.map +1 -0
  117. package/dist/models/social/Chat.d.ts +25 -0
  118. package/dist/models/social/Chat.d.ts.map +1 -0
  119. package/dist/models/social/Chat.js +48 -0
  120. package/dist/models/social/Chat.js.map +1 -0
  121. package/dist/models/social/ChatMessage.d.ts +16 -0
  122. package/dist/models/social/ChatMessage.d.ts.map +1 -0
  123. package/dist/models/social/ChatMessage.js +31 -0
  124. package/dist/models/social/ChatMessage.js.map +1 -0
  125. package/dist/models/social/Comment.d.ts +20 -0
  126. package/dist/models/social/Comment.d.ts.map +1 -0
  127. package/dist/models/social/Comment.js +38 -0
  128. package/dist/models/social/Comment.js.map +1 -0
  129. package/dist/models/social/Group.d.ts +30 -0
  130. package/dist/models/social/Group.d.ts.map +1 -0
  131. package/dist/models/social/Group.js +66 -0
  132. package/dist/models/social/Group.js.map +1 -0
  133. package/dist/models/social/Leaderboard.d.ts +24 -0
  134. package/dist/models/social/Leaderboard.d.ts.map +1 -0
  135. package/dist/models/social/Leaderboard.js +56 -0
  136. package/dist/models/social/Leaderboard.js.map +1 -0
  137. package/dist/models/social/Note.d.ts +15 -0
  138. package/dist/models/social/Note.d.ts.map +1 -0
  139. package/dist/models/social/Note.js +29 -0
  140. package/dist/models/social/Note.js.map +1 -0
  141. package/dist/models/social/Notification.d.ts +30 -0
  142. package/dist/models/social/Notification.d.ts.map +1 -0
  143. package/dist/models/social/Notification.js +88 -0
  144. package/dist/models/social/Notification.js.map +1 -0
  145. package/dist/models/social/NotificationSender.d.ts +18 -0
  146. package/dist/models/social/NotificationSender.d.ts.map +1 -0
  147. package/dist/models/social/NotificationSender.js +27 -0
  148. package/dist/models/social/NotificationSender.js.map +1 -0
  149. package/dist/models/social/Post.d.ts +41 -0
  150. package/dist/models/social/Post.d.ts.map +1 -0
  151. package/dist/models/social/Post.js +53 -0
  152. package/dist/models/social/Post.js.map +1 -0
  153. package/dist/models/social/Story.d.ts +16 -0
  154. package/dist/models/social/Story.d.ts.map +1 -0
  155. package/dist/models/social/Story.js +31 -0
  156. package/dist/models/social/Story.js.map +1 -0
  157. package/dist/models/social/SupportTicket.d.ts +20 -0
  158. package/dist/models/social/SupportTicket.d.ts.map +1 -0
  159. package/dist/models/social/SupportTicket.js +38 -0
  160. package/dist/models/social/SupportTicket.js.map +1 -0
  161. package/dist/models/store/StoreItem.d.ts +17 -0
  162. package/dist/models/store/StoreItem.d.ts.map +1 -0
  163. package/dist/models/store/StoreItem.js +34 -0
  164. package/dist/models/store/StoreItem.js.map +1 -0
  165. package/dist/services/AuthService.d.ts +30 -0
  166. package/dist/services/AuthService.d.ts.map +1 -0
  167. package/dist/services/AuthService.js +88 -0
  168. package/dist/services/AuthService.js.map +1 -0
  169. package/dist/services/SocialService.d.ts +28 -0
  170. package/dist/services/SocialService.d.ts.map +1 -0
  171. package/dist/services/SocialService.js +91 -0
  172. package/dist/services/SocialService.js.map +1 -0
  173. package/dist/services/SocketService.d.ts +20 -0
  174. package/dist/services/SocketService.d.ts.map +1 -0
  175. package/dist/services/SocketService.js +122 -0
  176. package/dist/services/SocketService.js.map +1 -0
  177. package/dist/services/UserService.d.ts +23 -0
  178. package/dist/services/UserService.d.ts.map +1 -0
  179. package/dist/services/UserService.js +73 -0
  180. package/dist/services/UserService.js.map +1 -0
  181. package/dist/types/stats.d.ts +17 -0
  182. package/dist/types/stats.d.ts.map +1 -0
  183. package/dist/types/stats.js +2 -0
  184. package/dist/types/stats.js.map +1 -0
  185. package/package.json +21 -0
  186. package/src/api/ApiClient.ts +57 -0
  187. package/src/index.ts +24 -0
  188. package/src/models/auth/Role.ts +26 -0
  189. package/src/models/auth/Session.ts +50 -0
  190. package/src/models/auth/User.ts +111 -0
  191. package/src/models/community/Classroom.ts +34 -0
  192. package/src/models/community/Event.ts +32 -0
  193. package/src/models/community/Faculty.ts +30 -0
  194. package/src/models/community/Forum.ts +42 -0
  195. package/src/models/community/Giveaway.ts +39 -0
  196. package/src/models/community/Group.ts +78 -0
  197. package/src/models/community/School.ts +51 -0
  198. package/src/models/community/SchoolTeam.ts +49 -0
  199. package/src/models/community/Station.ts +145 -0
  200. package/src/models/community/Survey.ts +53 -0
  201. package/src/models/community/SurveyAnswer.ts +26 -0
  202. package/src/models/community/Team.ts +24 -0
  203. package/src/models/community/Workplace.ts +32 -0
  204. package/src/models/content/Game.ts +39 -0
  205. package/src/models/content/Media.ts +30 -0
  206. package/src/models/content/Mod.ts +38 -0
  207. package/src/models/content/News.ts +43 -0
  208. package/src/models/content/Project.ts +49 -0
  209. package/src/models/core/PlatformStats.ts +74 -0
  210. package/src/models/core/SystemSettings.ts +59 -0
  211. package/src/models/index.ts +37 -0
  212. package/src/models/shop/CartItem.ts +31 -0
  213. package/src/models/shop/Order.ts +48 -0
  214. package/src/models/shop/Product.ts +61 -0
  215. package/src/models/social/Chat.ts +47 -0
  216. package/src/models/social/ChatMessage.ts +30 -0
  217. package/src/models/social/Comment.ts +38 -0
  218. package/src/models/social/Group.ts +63 -0
  219. package/src/models/social/Leaderboard.ts +57 -0
  220. package/src/models/social/Note.ts +28 -0
  221. package/src/models/social/Notification.ts +99 -0
  222. package/src/models/social/NotificationSender.ts +36 -0
  223. package/src/models/social/Post.ts +75 -0
  224. package/src/models/social/Story.ts +30 -0
  225. package/src/models/social/SupportTicket.ts +38 -0
  226. package/src/models/store/StoreItem.ts +32 -0
  227. package/src/services/AuthService.ts +91 -0
  228. package/src/services/SocialService.ts +92 -0
  229. package/src/services/SocketService.ts +112 -0
  230. package/src/services/UserService.ts +69 -0
  231. package/src/types/stats.ts +17 -0
  232. package/tsconfig.json +16 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../src/services/UserService.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Global Statistics Interface
3
+ * Bu arayüz, sitemizin genelindeki tüm sayısal verileri tutmak için tasarlanmıştır.
4
+ * İlerleyen aşamalarda bu veriler backend API üzerinden dinamik olarak beslenecektir.
5
+ */
6
+ export interface GlobalStats {
7
+ totalPlayers: number;
8
+ malePlayers: number;
9
+ femalePlayers: number;
10
+ totalForums: number;
11
+ totalPolls: number;
12
+ activeUsers24h: number;
13
+ totalMatchesPlayed: number;
14
+ totalGuilds: number;
15
+ monthlyVisitors: number;
16
+ totalNews: number;
17
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/types/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/types/stats.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@armoyu/core",
3
+ "version": "1.0.0",
4
+ "description": "Core business logic, models, and services for ARMOYU platforms.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch"
14
+ },
15
+ "dependencies": {
16
+ "socket.io-client": "^4.8.1"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.0.0"
20
+ }
21
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Core API Client for the ARMOYU platform.
3
+ * Used by all services in armoyu-core.
4
+ */
5
+
6
+ let _apiUrl = 'https://api.aramizdakioyuncu.com';
7
+ let _token: string | null = null;
8
+
9
+ export const ApiConfig = {
10
+ setBaseUrl(url: string) {
11
+ _apiUrl = url;
12
+ },
13
+ setToken(token: string | null) {
14
+ _token = token;
15
+ },
16
+ getToken(): string | null {
17
+ return _token;
18
+ }
19
+ };
20
+
21
+ export class ApiClient {
22
+ private static async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {
23
+ const headers = new Headers(options.headers || {});
24
+ headers.set('Content-Type', 'application/json');
25
+
26
+ if (_token) {
27
+ headers.set('Authorization', `Bearer ${_token}`);
28
+ }
29
+
30
+ const response = await fetch(`${_apiUrl}${endpoint}`, {
31
+ ...options,
32
+ headers,
33
+ });
34
+
35
+ if (!response.ok) {
36
+ throw new Error(`API Error: ${response.status} - ${response.statusText}`);
37
+ }
38
+
39
+ return response.json();
40
+ }
41
+
42
+ static async get<T>(endpoint: string, options?: RequestInit): Promise<T> {
43
+ return this.request<T>(endpoint, { ...options, method: 'GET' });
44
+ }
45
+
46
+ static async post<T>(endpoint: string, body: unknown, options?: RequestInit): Promise<T> {
47
+ return this.request<T>(endpoint, { ...options, method: 'POST', body: JSON.stringify(body) });
48
+ }
49
+
50
+ static async put<T>(endpoint: string, body: unknown, options?: RequestInit): Promise<T> {
51
+ return this.request<T>(endpoint, { ...options, method: 'PUT', body: JSON.stringify(body) });
52
+ }
53
+
54
+ static async delete<T>(endpoint: string, options?: RequestInit): Promise<T> {
55
+ return this.request<T>(endpoint, { ...options, method: 'DELETE' });
56
+ }
57
+ }
package/src/index.ts ADDED
@@ -0,0 +1,24 @@
1
+ // Models
2
+ export * from './models/index';
3
+
4
+ // Services
5
+ export * from './services/AuthService';
6
+ export * from './services/UserService';
7
+ export * from './services/SocialService';
8
+ export * from './services/SocketService';
9
+
10
+ // API
11
+ export * from './api/ApiClient';
12
+
13
+ export interface GlobalStats {
14
+ totalPlayers: number;
15
+ malePlayers: number;
16
+ femalePlayers: number;
17
+ totalForums: number;
18
+ totalPolls: number;
19
+ activeUsers24h: number;
20
+ totalMatchesPlayed: number;
21
+ totalGuilds: number;
22
+ monthlyVisitors: number;
23
+ totalNews: number;
24
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Represents a User Role in the aramizdakioyuncu.com platform.
3
+ */
4
+ export class Role {
5
+ id: string = '';
6
+ name: string = '';
7
+ color: string = '';
8
+ permissions: string[] = [];
9
+
10
+ constructor(data: Partial<Role>) {
11
+ Object.assign(this, data);
12
+ }
13
+
14
+ /**
15
+ * Instantiates a Role object from a JSON object.
16
+ */
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ static fromJSON(json: Record<string, any>): Role {
19
+ return new Role({
20
+ id: json.id || '',
21
+ name: json.name || json.title || '',
22
+ color: json.color || '#808080',
23
+ permissions: json.permissions || [],
24
+ });
25
+ }
26
+ }
@@ -0,0 +1,50 @@
1
+ import { User } from './User';
2
+ import { CartItem } from '../shop/CartItem';
3
+ import { Chat } from '../social/Chat';
4
+ import { Notification } from '../social/Notification';
5
+
6
+ export class Session {
7
+ user: User | null;
8
+ token: string | null;
9
+ refreshToken: string | null;
10
+ expiresAt: number | null; // Timestamp
11
+ cart: CartItem[];
12
+ myArticles: any[];
13
+ chatList: Chat[];
14
+ notifications: Notification[];
15
+
16
+ constructor(data: Partial<Session>) {
17
+ this.user = data.user || null;
18
+ this.token = data.token || null;
19
+ this.refreshToken = data.refreshToken || null;
20
+ this.expiresAt = data.expiresAt || null;
21
+ this.cart = data.cart || [];
22
+ this.myArticles = data.myArticles || [];
23
+ this.chatList = data.chatList || [];
24
+ this.notifications = data.notifications || [];
25
+ }
26
+
27
+ /**
28
+ * Checks if the session is still valid based on the expiration timestamp.
29
+ */
30
+ isValid(): boolean {
31
+ if (!this.token || !this.expiresAt) return false;
32
+ return Date.now() < this.expiresAt;
33
+ }
34
+
35
+ /**
36
+ * Static factory for creating a Session instance from a JSON object.
37
+ */
38
+ static fromJSON(json: any): Session {
39
+ return new Session({
40
+ user: json.user ? User.fromJSON(json.user) : null,
41
+ token: json.token || json.jwt_token || null,
42
+ refreshToken: json.refreshToken || json.refresh_token || null,
43
+ expiresAt: json.expiresAt || json.expires_at || (Date.now() + 3600 * 1000), // Default 1 hour
44
+ cart: Array.isArray(json.cart) ? json.cart.map((i: any) => CartItem.fromJSON(i)) : [],
45
+ myArticles: json.myArticles || [],
46
+ chatList: Array.isArray(json.chatList) ? json.chatList.map((c: any) => Chat.fromJSON(c)) : [],
47
+ notifications: Array.isArray(json.notifications) ? json.notifications.map((n: any) => Notification.fromJSON(n)) : [],
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,111 @@
1
+ import { Role } from './Role';
2
+ import { NotificationSender } from '../social/NotificationSender';
3
+ import { Team } from '../community/Team';
4
+
5
+ export interface CareerEvent {
6
+ id: string;
7
+ date: string;
8
+ title: string;
9
+ description: string;
10
+ type: 'JOIN' | 'RANK' | 'GROUP' | 'AWARD' | 'SYSTEM';
11
+ icon?: string;
12
+ }
13
+
14
+ /**
15
+ * Represents a User in the aramizdakioyuncu.com platform.
16
+ */
17
+ export class User {
18
+ id: string = '';
19
+ username: string = '';
20
+ displayName: string = '';
21
+ avatar: string = '';
22
+ banner: string = '';
23
+ bio: string = '';
24
+ role: Role | null = null;
25
+ verified: boolean = false;
26
+ level: number = 1;
27
+ xp: number = 0;
28
+ popScore: number = 0;
29
+ groups: any[] = [];
30
+ friends: User[] = [];
31
+ myPosts: any[] = [];
32
+ career: CareerEvent[] = [];
33
+ zodiac?: string;
34
+ favoriteTeam?: any; // To avoid circular dependency if needed, or use Team
35
+ punishmentCount: number = 0;
36
+ distrustScore: number = 1.0; // Starts at 1.0 (Safe)
37
+ odp: number = 50; // Player Rating Score (0-100)
38
+
39
+ constructor(data: Partial<User>) {
40
+ Object.assign(this, data);
41
+ // Ensure numeric defaults
42
+ this.punishmentCount = data.punishmentCount || 0;
43
+ this.distrustScore = data.distrustScore || 1.0;
44
+ this.odp = data.odp || 50;
45
+ }
46
+
47
+ /**
48
+ * Adds a new event to the user's career timeline.
49
+ */
50
+ addCareerEvent(event: Omit<CareerEvent, 'id'>) {
51
+ const newEvent: CareerEvent = {
52
+ ...event,
53
+ id: `CR-${Math.random().toString(36).substr(2, 5).toUpperCase()}`
54
+ };
55
+ this.career = [newEvent, ...(this.career || [])];
56
+ }
57
+
58
+ /**
59
+ * Returns the absolute URL to the user's profile page.
60
+ */
61
+ getProfileUrl(): string {
62
+ return `/oyuncular/${this.username}`;
63
+ }
64
+
65
+ /**
66
+ * Converts the user to a standardized notification sender.
67
+ */
68
+ toNotificationSender(): NotificationSender {
69
+ return new NotificationSender({
70
+ id: this.id,
71
+ name: this.displayName,
72
+ avatar: this.avatar,
73
+ type: 'USER',
74
+ url: this.getProfileUrl()
75
+ });
76
+ }
77
+
78
+ /**
79
+ * Instantiates a User object from a JSON object.
80
+ */
81
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
+ static fromJSON(json: Record<string, any>): User {
83
+ return new User({
84
+ id: json.id || json.id_user || '',
85
+ username: json.username || '',
86
+ displayName: json.displayName || json.name || json.username || '',
87
+ avatar: json.avatar || json.avatar_url || '',
88
+ banner: json.banner || json.banner_url || 'https://images.unsplash.com/photo-1614680376593-902f74cf0d41?q=80&w=2574&auto=format&fit=crop',
89
+ bio: json.bio || '',
90
+ role: json.role ? Role.fromJSON(json.role) : null,
91
+ verified: json.verified || false,
92
+ level: json.level || json.user_level || 1,
93
+ xp: json.xp || json.experience || 0,
94
+ popScore: json.popScore || 0,
95
+ groups: json.groups || [],
96
+ friends: Array.isArray(json.friends) ? json.friends.map((f: any) => {
97
+ // Shallow conversion to avoid infinite recursion
98
+ if (f instanceof User) return f;
99
+ return new User({
100
+ id: f.id || f.id_user || '',
101
+ username: f.username || '',
102
+ displayName: f.displayName || f.name || f.username || '',
103
+ avatar: f.avatar || f.avatar_url || '',
104
+ role: f.role ? Role.fromJSON(f.role) : null,
105
+ verified: f.verified || false,
106
+ level: f.level || 1
107
+ });
108
+ }) : [],
109
+ });
110
+ }
111
+ }
@@ -0,0 +1,34 @@
1
+ import { User } from '../auth/User';
2
+
3
+ /**
4
+ * Represents a Classroom (Sınıf) in the ARMOYU education ecosystem.
5
+ */
6
+ export class Classroom {
7
+ id: string = '';
8
+ name: string = '';
9
+ password?: string = '';
10
+ schoolId: string = '';
11
+ members: User[] = [];
12
+ teacher: User | null = null;
13
+ memberCount: number = 0;
14
+
15
+ constructor(data: Partial<Classroom>) {
16
+ Object.assign(this, data);
17
+ }
18
+
19
+ /**
20
+ * Instantiates a Classroom object from a JSON object.
21
+ */
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ static fromJSON(json: Record<string, any>): Classroom {
24
+ return new Classroom({
25
+ id: json.id || '',
26
+ name: json.name || '',
27
+ password: json.password || '',
28
+ schoolId: json.schoolId || '',
29
+ members: Array.isArray(json.members) ? json.members.map(User.fromJSON) : [],
30
+ teacher: json.teacher ? User.fromJSON(json.teacher) : null,
31
+ memberCount: json.memberCount || 0
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,32 @@
1
+ export class ArmoyuEvent {
2
+ id: string = '';
3
+ title: string = '';
4
+ status: string = '';
5
+ banner: string = '';
6
+ date: string = '';
7
+ location: string = '';
8
+ participantLimit: number = 0;
9
+ currentParticipants: number = 0;
10
+ description: string = '';
11
+ rules: string[] = [];
12
+ admins: any[] = [];
13
+ game: string = '';
14
+ rewards: string = '';
15
+ isHot: boolean = false;
16
+ isLive: boolean = false;
17
+ participants: any[] = []; // Array of participant objects/userslf
18
+ participationType: 'INDIVIDUAL' | 'GROUP' | 'BOTH' = 'INDIVIDUAL';
19
+ minODP: number = 0; // Minimum score required to join
20
+ hasStats: boolean = false; // Whether to show statistics tab
21
+ template: 'STANDARD' | 'TOURNAMENT' | 'TRAINING' = 'STANDARD';
22
+ teams: any[] = []; // List of teams for tournament template
23
+ leaderboard: any[] = []; // List of top performers
24
+
25
+ constructor(data: Partial<ArmoyuEvent>) {
26
+ Object.assign(this, data);
27
+ }
28
+
29
+ static fromJSON(json: any): ArmoyuEvent {
30
+ return new ArmoyuEvent(json);
31
+ }
32
+ }
@@ -0,0 +1,30 @@
1
+ import { User } from '../auth/User';
2
+
3
+ /**
4
+ * Represents a Faculty (Fakülte) within a School.
5
+ */
6
+ export class Faculty {
7
+ id: string = '';
8
+ name: string = '';
9
+ schoolId: string = '';
10
+ representative: User | null = null;
11
+ memberCount: number = 0;
12
+
13
+ constructor(data: Partial<Faculty>) {
14
+ Object.assign(this, data);
15
+ }
16
+
17
+ /**
18
+ * Instantiates a Faculty object from a JSON object.
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ static fromJSON(json: Record<string, any>): Faculty {
22
+ return new Faculty({
23
+ id: json.id || '',
24
+ name: json.name || '',
25
+ schoolId: json.schoolId || '',
26
+ representative: json.representative ? User.fromJSON(json.representative) : null,
27
+ memberCount: json.memberCount || 0
28
+ });
29
+ }
30
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Represents a Forum Board (Forum Bölümü) in the aramizdakioyuncu.com platform.
3
+ */
4
+ export class Forum {
5
+ id: string = '';
6
+ name: string = '';
7
+ desc: string = '';
8
+ topicCount: number = 0;
9
+ postCount: number = 0;
10
+ lastPost?: {
11
+ topicTitle: string;
12
+ author: string;
13
+ avatar: string;
14
+ time: string;
15
+ };
16
+
17
+ constructor(data: Partial<Forum>) {
18
+ Object.assign(this, data);
19
+ }
20
+
21
+ /**
22
+ * Returns the absolute URL to the forum board.
23
+ */
24
+ getUrl(): string {
25
+ return `/forum/${this.id}`;
26
+ }
27
+
28
+ /**
29
+ * Instantiates a Forum object from a JSON object.
30
+ */
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ static fromJSON(json: Record<string, any>): Forum {
33
+ return new Forum({
34
+ id: json.id || '',
35
+ name: json.name || json.title || '',
36
+ desc: json.desc || json.description || '',
37
+ topicCount: json.topicCount || 0,
38
+ postCount: json.postCount || 0,
39
+ lastPost: json.lastPost || null,
40
+ });
41
+ }
42
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Represents a Giveaway (Çekiliş) in the aramizdakioyuncu.com platform.
3
+ */
4
+ export class Giveaway {
5
+ id: string = '';
6
+ title: string = '';
7
+ prize: string = '';
8
+ status: 'active' | 'ended' = 'active';
9
+ participants: number = 0;
10
+ timeLeft: string = '';
11
+ image: string = '';
12
+
13
+ constructor(data: Partial<Giveaway>) {
14
+ Object.assign(this, data);
15
+ }
16
+
17
+ /**
18
+ * Returns true if the giveaway is currently active.
19
+ */
20
+ isActive(): boolean {
21
+ return this.status === 'active';
22
+ }
23
+
24
+ /**
25
+ * Instantiates a Giveaway object from a JSON object.
26
+ */
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ static fromJSON(json: Record<string, any>): Giveaway {
29
+ return new Giveaway({
30
+ id: json.id || '',
31
+ title: json.title || '',
32
+ prize: json.prize || '',
33
+ status: json.status || 'active',
34
+ participants: json.participants || 0,
35
+ timeLeft: json.timeLeft || json.time_left || '',
36
+ image: json.image || '',
37
+ });
38
+ }
39
+ }
@@ -0,0 +1,78 @@
1
+ import { User } from '../auth/User';
2
+ import { NotificationSender } from '../social/NotificationSender';
3
+
4
+ /**
5
+ * Represents a Group (Grup) in the aramizdakioyuncu.com platform.
6
+ */
7
+ export class Group {
8
+ id: string = '';
9
+ name: string = '';
10
+ shortName: string = '';
11
+ slug: string = '';
12
+ description: string = '';
13
+ category: string = '';
14
+ tag: string = '';
15
+ banner: string = '';
16
+ logo: string = '';
17
+ recruitment: string = 'Açık';
18
+ date: string = '';
19
+ memberCount: number = 0;
20
+ isPrivate: boolean = false;
21
+ owner: User | null = null;
22
+ moderators: User[] = [];
23
+ members: User[] = [];
24
+ permissions: string[] = [];
25
+
26
+ constructor(data: Partial<Group>) {
27
+ Object.assign(this, data);
28
+ if (!this.slug && this.name) {
29
+ this.slug = this.name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Returns the absolute URL to the group's page.
35
+ */
36
+ getGroupUrl(): string {
37
+ return `/gruplar/${this.slug || this.name.toLowerCase().replace(/\s+/g, '-')}`;
38
+ }
39
+
40
+ /**
41
+ * Converts the group to a standardized notification sender.
42
+ */
43
+ toNotificationSender(): NotificationSender {
44
+ return new NotificationSender({
45
+ id: this.id,
46
+ name: this.name,
47
+ avatar: this.logo,
48
+ type: 'GROUP',
49
+ url: this.getGroupUrl()
50
+ });
51
+ }
52
+
53
+ /**
54
+ * Instantiates a Group object from a JSON object.
55
+ */
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ static fromJSON(json: Record<string, any>): Group {
58
+ return new Group({
59
+ id: json.id || '',
60
+ name: json.name || '',
61
+ shortName: json.shortName || json.name_short || '',
62
+ slug: json.slug || '',
63
+ description: json.description || '',
64
+ category: json.category || '',
65
+ tag: json.tag || '',
66
+ banner: json.banner || json.banner_url || '',
67
+ logo: json.logo || json.logo_url || '',
68
+ recruitment: json.recruitment || 'Açık',
69
+ date: json.date || json.created_at || '',
70
+ memberCount: json.memberCount || json.member_count || 0,
71
+ isPrivate: json.isPrivate || json.is_private || false,
72
+ owner: json.owner ? User.fromJSON(json.owner) : null,
73
+ moderators: Array.isArray(json.moderators) ? json.moderators.map((m: any) => User.fromJSON(m)) : [],
74
+ members: Array.isArray(json.members) ? json.members.map((m: any) => User.fromJSON(m)) : [],
75
+ permissions: Array.isArray(json.permissions) ? json.permissions : [],
76
+ });
77
+ }
78
+ }
@@ -0,0 +1,51 @@
1
+ import { User } from '../auth/User';
2
+ import { Faculty } from './Faculty';
3
+ import { Classroom } from './Classroom';
4
+ import { SchoolTeam } from './SchoolTeam';
5
+
6
+ /**
7
+ * Represents a School (Okul/Üniversite) in the ARMOYU education ecosystem.
8
+ */
9
+ export class School {
10
+ id: string = '';
11
+ name: string = '';
12
+ slug: string = '';
13
+ logo: string = '';
14
+ background?: string = '';
15
+ description?: string = '';
16
+
17
+ representative: User | null = null;
18
+ faculties: Faculty[] = [];
19
+ teams: SchoolTeam[] = [];
20
+ classrooms: Classroom[] = [];
21
+
22
+ joinPassword?: string = '';
23
+ isSocialFeedEnabled: boolean = true;
24
+ memberCount: number = 0;
25
+
26
+ constructor(data: Partial<School>) {
27
+ Object.assign(this, data);
28
+ }
29
+
30
+ /**
31
+ * Instantiates a School object from a JSON object.
32
+ */
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ static fromJSON(json: Record<string, any>): School {
35
+ return new School({
36
+ id: json.id || '',
37
+ name: json.name || '',
38
+ slug: json.slug || '',
39
+ logo: json.logo || '',
40
+ background: json.background || '',
41
+ description: json.description || '',
42
+ representative: json.representative ? User.fromJSON(json.representative) : null,
43
+ faculties: Array.isArray(json.faculties) ? json.faculties.map(Faculty.fromJSON) : [],
44
+ teams: Array.isArray(json.teams) ? json.teams.map(SchoolTeam.fromJSON) : [],
45
+ classrooms: Array.isArray(json.classrooms) ? json.classrooms.map(Classroom.fromJSON) : [],
46
+ joinPassword: json.joinPassword || '',
47
+ isSocialFeedEnabled: json.isSocialFeedEnabled !== undefined ? json.isSocialFeedEnabled : true,
48
+ memberCount: json.memberCount || 0
49
+ });
50
+ }
51
+ }