@armoyu/core 1.0.0 → 1.0.1
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.
- package/dist/api/ApiClient.d.ts +49 -11
- package/dist/api/ApiClient.js +137 -33
- package/dist/api/ArmoyuApi.d.ts +38 -0
- package/dist/api/ArmoyuApi.js +66 -0
- package/dist/armoyu-core.bundle.js +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +9 -2
- package/dist/models/auth/User.js +17 -22
- package/dist/models/core/Rule.d.ts +23 -0
- package/dist/models/core/Rule.js +39 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/social/Post.js +15 -15
- package/dist/services/AuthService.d.ts +11 -10
- package/dist/services/AuthService.js +56 -27
- package/dist/services/BaseService.d.ts +10 -0
- package/dist/services/BaseService.js +27 -0
- package/dist/services/BlogService.d.ts +16 -0
- package/dist/services/BlogService.js +54 -0
- package/dist/services/BotService.d.ts +28 -0
- package/dist/services/BotService.js +92 -0
- package/dist/services/ForumService.d.ts +19 -0
- package/dist/services/ForumService.js +64 -0
- package/dist/services/RuleService.d.ts +28 -0
- package/dist/services/RuleService.js +90 -0
- package/dist/services/ShopService.d.ts +20 -0
- package/dist/services/ShopService.js +53 -0
- package/dist/services/SocialService.d.ts +8 -7
- package/dist/services/SocialService.js +26 -21
- package/dist/services/SupportService.d.ts +16 -0
- package/dist/services/SupportService.js +54 -0
- package/dist/services/UserService.d.ts +12 -7
- package/dist/services/UserService.js +35 -18
- package/package.json +27 -21
- package/src/api/ApiClient.ts +0 -57
- package/src/index.ts +0 -24
- package/src/models/auth/Role.ts +0 -26
- package/src/models/auth/Session.ts +0 -50
- package/src/models/auth/User.ts +0 -111
- package/src/models/community/Classroom.ts +0 -34
- package/src/models/community/Event.ts +0 -32
- package/src/models/community/Faculty.ts +0 -30
- package/src/models/community/Forum.ts +0 -42
- package/src/models/community/Giveaway.ts +0 -39
- package/src/models/community/Group.ts +0 -78
- package/src/models/community/School.ts +0 -51
- package/src/models/community/SchoolTeam.ts +0 -49
- package/src/models/community/Station.ts +0 -145
- package/src/models/community/Survey.ts +0 -53
- package/src/models/community/SurveyAnswer.ts +0 -26
- package/src/models/community/Team.ts +0 -24
- package/src/models/community/Workplace.ts +0 -32
- package/src/models/content/Game.ts +0 -39
- package/src/models/content/Media.ts +0 -30
- package/src/models/content/Mod.ts +0 -38
- package/src/models/content/News.ts +0 -43
- package/src/models/content/Project.ts +0 -49
- package/src/models/core/PlatformStats.ts +0 -74
- package/src/models/core/SystemSettings.ts +0 -59
- package/src/models/index.ts +0 -37
- package/src/models/shop/CartItem.ts +0 -31
- package/src/models/shop/Order.ts +0 -48
- package/src/models/shop/Product.ts +0 -61
- package/src/models/social/Chat.ts +0 -47
- package/src/models/social/ChatMessage.ts +0 -30
- package/src/models/social/Comment.ts +0 -38
- package/src/models/social/Group.ts +0 -63
- package/src/models/social/Leaderboard.ts +0 -57
- package/src/models/social/Note.ts +0 -28
- package/src/models/social/Notification.ts +0 -99
- package/src/models/social/NotificationSender.ts +0 -36
- package/src/models/social/Post.ts +0 -75
- package/src/models/social/Story.ts +0 -30
- package/src/models/social/SupportTicket.ts +0 -38
- package/src/models/store/StoreItem.ts +0 -32
- package/src/services/AuthService.ts +0 -91
- package/src/services/SocialService.ts +0 -92
- package/src/services/SocketService.ts +0 -112
- package/src/services/UserService.ts +0 -69
- package/src/types/stats.ts +0 -17
- package/tsconfig.json +0 -16
package/src/api/ApiClient.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/auth/Role.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|
package/src/models/auth/User.ts
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { User } from '../auth/User';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type of School Team (Traditional Sports or E-sports).
|
|
5
|
-
*/
|
|
6
|
-
export type TeamType = 'ESPORTS' | 'TRADITIONAL_SPORTS';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Represents a School Team (Okul Takımı) for specific games or sports.
|
|
10
|
-
*/
|
|
11
|
-
export class SchoolTeam {
|
|
12
|
-
id: string = '';
|
|
13
|
-
name: string = ''; // e.g., "UAV FB", "ARMOYU CS2"
|
|
14
|
-
gameOrSport: string = ''; // e.g., "Football", "Volleyball", "Counter-Strike 2"
|
|
15
|
-
type: TeamType = 'ESPORTS';
|
|
16
|
-
logo?: string = '';
|
|
17
|
-
|
|
18
|
-
schoolId: string = '';
|
|
19
|
-
captain: User | null = null;
|
|
20
|
-
coach: User | null = null;
|
|
21
|
-
members: User[] = [];
|
|
22
|
-
memberCount: number = 0;
|
|
23
|
-
|
|
24
|
-
achievements: string[] = [];
|
|
25
|
-
|
|
26
|
-
constructor(data: Partial<SchoolTeam>) {
|
|
27
|
-
Object.assign(this, data);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Instantiates a SchoolTeam object from a JSON object.
|
|
32
|
-
*/
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
static fromJSON(json: Record<string, any>): SchoolTeam {
|
|
35
|
-
return new SchoolTeam({
|
|
36
|
-
id: json.id || '',
|
|
37
|
-
name: json.name || '',
|
|
38
|
-
gameOrSport: json.gameOrSport || json.game_or_sport || '',
|
|
39
|
-
type: (json.type as TeamType) || 'ESPORTS',
|
|
40
|
-
logo: json.logo || '',
|
|
41
|
-
schoolId: json.schoolId || '',
|
|
42
|
-
captain: json.captain ? User.fromJSON(json.captain) : null,
|
|
43
|
-
coach: json.coach ? User.fromJSON(json.coach) : null,
|
|
44
|
-
members: Array.isArray(json.members) ? json.members.map(User.fromJSON) : [],
|
|
45
|
-
memberCount: json.memberCount || 0,
|
|
46
|
-
achievements: json.achievements || []
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|