Skip to content

Commit

Permalink
style(common/types): prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
MM25Zamanian committed Oct 10, 2024
1 parent 384d3d9 commit bd99f76
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
27 changes: 24 additions & 3 deletions packages/common/types/src/group.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
import type { Entity, Jsonize } from './core';
import type { SessionInterface } from './session';
import type { UserInterface } from './user';
import type { Model } from 'mongoose';

export interface GroupTasksInterface {
taskId: string;
title: string;
description: string;
}

export interface GroupTasksStatsInterface extends GroupTasksInterface {
done: number;
failed: number;
percentage: number;
}

export interface GroupInterface extends Entity {
teachers: UserInterface[];
students: UserInterface[];

defaultSessionStartedAt: number;
defaultSessionLength: number;
sessionDefaults: {
startedAt: number;
length: number;
};

sessions: SessionInterface[];

tasks: GroupTasksInterface[];
}

export interface GroupInterfaceQueryHelpers {}
export interface GroupInterfaceInstanceMethods {}
export interface GroupInterfaceInstanceMethods {
calculateTasksStats(sessionId?: string): Promise<GroupTasksStatsInterface[]>;
}
export interface GroupInterfaceVirtuals {}
export interface GroupInterfaceStatics {}

Expand Down
13 changes: 11 additions & 2 deletions packages/common/types/src/session.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import type { Entity, Jsonize } from './core';
import type { GroupInterface } from './group';
import type { GroupInterface, GroupTasksInterface } from './group';
import type { Model } from 'mongoose';

export interface SessionTasksInterface extends GroupTasksInterface {
done: boolean;
}

export interface SessionInterface extends Entity {
startedAt: Date;
length: number;

summary: string;

group: GroupInterface;
attendance: Record<string, number>;

tasks: SessionTasksInterface[];
}

export interface SessionInterfaceQueryHelpers {}
export interface SessionInterfaceInstanceMethods {
makeFromGroup(startDate: number): Promise<SessionInterface>;
setDefaults(startDate: number): Promise<SessionInterface>;
}
export interface SessionInterfaceVirtuals {
readonly endedAt: Date;
Expand Down
15 changes: 15 additions & 0 deletions packages/common/types/src/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Entity, Jsonize, ModelsType } from './core';
import type { GroupInterface } from './group';
import type { PartialDeep } from '@gecut/types';
import type { Model } from 'mongoose';

Expand Down Expand Up @@ -28,12 +29,26 @@ export interface UserInterface extends Entity {
}
>
>;

teaching: GroupInterface[];
studying: GroupInterface[];
}

export interface UserInterfaceQueryHelpers {}
export interface UserInterfaceInstanceMethods {
makeOTP(): string;
makeToken(): string;
calculateAttendanceProgress(groupId?: string): Promise<{
sessions: number;
presences: number;
absences: number;
percentage: number;
}>;
calculateDelaysStats(groupId?: string): Promise<{
sessions: number; // * To Minutes
delays: number; // * To Minutes
percentage: number;
}>;
}
export interface UserInterfaceVirtuals {
readonly fullName: string;
Expand Down

0 comments on commit bd99f76

Please sign in to comment.