StudE-Frontend/src/interfaces/Interfaces.tsx

213 lines
4 KiB
TypeScript
Raw Normal View History

2023-08-07 14:55:44 +08:00
import * as Location from "expo-location";
2023-08-15 14:15:33 +08:00
import { GetStudentStatus } from "../components/Api/Api";
2023-09-06 18:13:43 +08:00
import { Float } from "react-native/Libraries/Types/CodegenTypes";
2023-08-07 14:55:44 +08:00
export interface IconProps {
size: number;
2023-07-03 21:22:31 +08:00
}
export interface ResponsiveIconProps {
size: number;
color: string;
}
export interface RootDrawerParamList {
navigate: any;
}
// Redux Interfaces
export interface LoginState {
Login: { logged_in: boolean };
}
export interface LoggedInUserState {
LoggedInUser: {
value: {
email: string;
id: number;
username: string;
};
};
}
// API Interfaces
export interface RegistrationType {
email: string;
username: string;
password: string;
2023-07-03 21:22:31 +08:00
first_name: string;
last_name: string;
student_id_number: string;
}
export interface LoginType {
username: string;
password: string;
}
export interface ActivationType {
uid: string;
token: string;
}
2023-07-18 17:20:11 +08:00
export interface OptionType {
label: string;
value: string;
}
// Semester
export interface SemesterType {
id: string;
name: string;
shortname: string;
}
export type SemestersType = Array<SemesterType>;
2023-07-17 22:44:50 +08:00
export type SemesterReturnType = [boolean, SemestersType];
// Year Level
export interface YearLevelType {
id: string;
name: string;
shortname: string;
}
export type YearLevelsType = Array<YearLevelType>;
export type YearLevelReturnType = [boolean, YearLevelsType];
// Course
export interface CourseType {
id: string;
name: string;
shortname: string;
}
export type CoursesType = Array<CourseType>;
export type CourseReturnType = [boolean, CoursesType];
2023-07-06 20:29:04 +08:00
// Subject
export interface SubjectType {
id: number;
name: string;
code: string;
course: string;
year_level: string;
semester: string;
}
2023-07-18 17:20:11 +08:00
export type SubjectsType = Array<SubjectType>;
export type SubjectsReturnType = [boolean, SubjectsType];
export type AvatarType = {
2023-07-27 16:00:31 +08:00
uri: string;
type: string;
name: string;
};
2023-07-18 17:20:11 +08:00
// For dropdown menu
export interface OnboardingType {
2023-07-06 20:29:04 +08:00
year_level: string;
course: string;
semester: string;
}
2023-07-17 15:10:44 +08:00
export interface PatchUserInfoType {
course?: string;
first_name?: string;
last_name?: string;
semester?: string;
subjects?: string[];
year_level?: string;
irregular?: boolean;
avatar?: string;
2023-07-17 18:45:25 +08:00
}
export interface LocationType {
2023-09-06 18:13:43 +08:00
latitude: Float;
longitude: Float;
2023-08-10 17:23:12 +08:00
}
export interface StudentStatusType {
subject: string;
location: LocationType;
landmark: string | null;
active: boolean;
}
export interface StudentStatusPatchType {
2023-08-10 17:23:12 +08:00
subject?: string;
location?: LocationType;
2023-08-10 17:23:12 +08:00
landmark?: string | null;
active?: boolean;
}
2023-09-06 18:13:43 +08:00
export interface StudentStatusFilterType {
active: boolean;
distance: number;
landmark: string | null;
location: LocationType;
2023-09-06 18:13:43 +08:00
study_group?: string;
subject: string;
user: string;
weight?: number;
}
export interface StudentStatusFilterTypeFlattened {
active: boolean;
distance: number;
landmark: string | null;
latitude: Float;
longitude: Float;
study_group?: string;
subject: string;
user: string;
weight?: number;
2023-09-06 18:13:43 +08:00
}
export interface StudyGroupType {
name: string;
users: string[];
distance: number;
landmark: string | null;
location: LocationType;
subject: string;
radius: number;
}
export type StudyGroupReturnType = [boolean, StudyGroupType[]];
export type StudentStatusReturnType = [boolean, StudentStatusType];
2023-08-10 17:23:12 +08:00
2023-09-06 18:13:43 +08:00
export type StudentStatusListType = Array<StudentStatusFilterType>;
2023-08-15 14:15:33 +08:00
export type StudentStatusListReturnType = [boolean, StudentStatusListType];
export type RawLocationType = Location.LocationObject;
2023-08-10 17:23:12 +08:00
export interface UserInfoType {
2023-07-17 15:10:44 +08:00
first_name: string;
last_name: string;
email: string;
avatar: string;
2023-07-17 15:10:44 +08:00
student_id_number: string;
irregular: boolean;
semester: string;
semester_shortname: string;
course: string;
course_shortname: string;
year_level: string;
yearlevel_shortname: string;
2023-08-10 17:23:12 +08:00
subjects: string[];
2023-07-17 15:10:44 +08:00
username: string;
}
export type UserInfoReturnType = [boolean, UserInfoType];
export type subjectUserMapType = {
subject: string;
users: string[];
latitude: Float;
longitude: Float;
radius: Float;
};