Skip to content

Commit

Permalink
fix: fix BaseObject types
Browse files Browse the repository at this point in the history
  • Loading branch information
maelgangloff committed Apr 20, 2023
1 parent 9b1db9e commit 784aa49
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import { PeriodicReportsFile } from './models/Evaluation/PeriodicReportsFile'
import { AbsenceFile, AbsenceFileIncluded } from './models/Assiduite/AbsenceFile'
import { AbsenceReason } from './models/Assiduite/AbsenceReasons'

export { TokenSet } from 'openid-client'

const BASE_URL = 'https://api.skolengo.com/api/v1/bff-sko-app'
const OID_CLIENT_ID = Buffer.from('U2tvQXBwLlByb2QuMGQzNDkyMTctOWE0ZS00MWVjLTlhZjktZGY5ZTY5ZTA5NDk0', 'base64').toString('ascii') // base64 du client ID de l'app mobile
const OID_CLIENT_SECRET = Buffer.from('N2NiNGQ5YTgtMjU4MC00MDQxLTlhZTgtZDU4MDM4NjkxODNm', 'base64').toString('ascii') // base64 du client Secret de l'app mobile
Expand Down Expand Up @@ -791,3 +789,5 @@ export class Skolengo {
}
}
}

export { TokenSet }
4 changes: 2 additions & 2 deletions src/models/App/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type UserAttributes = {
permissions: (
UserPermission<'EVAL', 'READ_EVALUATIONS'> |
UserPermission<'CDT', 'READ_LESSONS'> |
UserPermission<'TAF', 'READ_HOMEWORK_ASSIGNMENTS'> |
UserPermission<'TAF', 'READ_HOMEWORK_ASSIGNMENTS' | 'MARK_HOMEWORK_ASSIGNMENT_AS_DONE'> |
UserPermission<'ABS', 'READ_ABSENCE_FILES' | 'READ_ABSENCE_FILES_DETAILS' | 'COMPLETE_ABSENCE_FILES'> |
UserPermission<'MSG', 'READ_MESSAGES' | 'WRITE_MESSAGES'> | UserPermission<string, string>
)[];
Expand All @@ -42,7 +42,7 @@ export type User = BaseResponse<UserAttributes, UserRelationships, 'legalReprese
export type UserIncludedAttributes = {
name: string;
timeZone: string;
subscribedServices: string[];
subscribedServices: ('MSG' | 'SKOAPP' | 'ABS' | 'CDT' | 'ART' | 'TAF' | 'EVAL' | 'COMC' | string)[];
} | {
lastName: string;
firstName: string;
Expand Down
2 changes: 1 addition & 1 deletion src/models/Assiduite/AbsenceFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type AbsenceFileIncludedAttributes = {
} | {
code: string;
longLabel: string;
supportedAbsenceTypes: string[];
supportedAbsenceTypes: SupportedAbsenceType[] | string[];
} | SimpleUser

export type AbsenceFileIncludedRelationships = {
Expand Down
15 changes: 11 additions & 4 deletions src/models/Evaluation/Evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type EvaluationAttributes = {

export type EvaluationRelationships = {
evaluations: {
data: BaseObject[];
data: BaseObject<'evaluation'>[];
};
subject: {
data: BaseObject<'subject'>
Expand Down Expand Up @@ -38,17 +38,24 @@ export type EvaluationIncludedAttributes = SimpleUser | {
} | {
label: string;
color: null | string;
} | {
shortLabel: string
} | {
level: string
}

export type EvaluationIncludedRelationships = {
subSkills?: {
data: BaseObject[];
data: BaseObject<'subSkill'>[];
};
evaluationResult?: {
data: BaseObject
data: BaseObject<'evaluationResult'>
};
subSkillsEvaluationResults?: {
data: BaseObject[];
data: BaseObject<'subSkillEvaluationResult'>[];
},
subSkill?: {
data: BaseObject<'subSkill'>
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/models/Evaluation/EvaluationDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export type EvaluationDetailAttributes = {

export type EvaluationDetailRelationships = {
subSkills: {
data: BaseObject[] | null;
data: BaseObject<'subSkill'>[] | null;
};
subSubject: {
data: BaseObject[] | null;
data: BaseObject<'subSubject'> | null;
};
evaluationService: {
data: BaseObject
data: BaseObject<'evaluationService'>
};
evaluationResult: {
data: BaseObject
data: BaseObject<'evaluationResult'>
};
}

Expand All @@ -45,7 +45,7 @@ export type EvaluationDetailIncludedAttributes = SimpleUser | {

export type EvaluationDetailIncludedRelationships = {
subSkillsEvaluationResults?: {
data: BaseObject[] | null;
data: BaseObject<'subSkillEvaluationResult'>[] | null;
};
subject?: {
data: BaseObject<'subject'>
Expand Down
4 changes: 2 additions & 2 deletions src/models/Evaluation/EvaluationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type EvaluationSettingsIncludedAttributes = {

export type EvaluationSettingsIncludedRelationships = {
skillAcquisitionColors: {
data: BaseObject
data: BaseObject<'skillAcquisitionColors'>
};
}

Expand All @@ -34,7 +34,7 @@ export type EvaluationSettingsRelationships = {
data: BaseObject<'period'>[];
};
skillsSetting: {
data: BaseObject
data: BaseObject<'skillsSetting'>
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/models/Evaluation/PeriodicReportsFile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseResponse } from '../Globals'
import { BaseObject, BaseResponse } from '../Globals'

export type PeriodicReportsFileAttributes = {
name: string
Expand All @@ -11,7 +11,7 @@ export type PeriodicReportsFileAttributes = {

export type PeriodicReportsFileRelationships = {
period: {
data :any
data : BaseObject<'period'> | null
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/models/Messagerie/Communication.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SimpleUser } from '../App/User'
import { BaseResponse, BaseObject } from '../Globals'
import { PersonType } from './UsersMailSettings'

export type CommunicationAttributes = {
subject: string;
Expand Down Expand Up @@ -37,10 +38,10 @@ export type CommunicationIncluded = BaseResponse<SimpleUser | {
data: BaseObject | null;
};
technicalUser?: {
data: BaseObject | null;
data: BaseObject<'technicalUser'> | null;
};
person?: {
data: BaseObject | null;
data: BaseObject<PersonType> | null;
};
}>

Expand Down
18 changes: 14 additions & 4 deletions src/models/Messagerie/Participation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { SimpleUser } from '../App/User'
import { BaseResponse, BaseObject } from '../Globals'
import { PersonType } from './UsersMailSettings'

export type Participation = BaseResponse<{
dateTime: string;
Expand All @@ -13,18 +15,26 @@ export type Participation = BaseResponse<{
};
}, 'participation'>

export type ParticipationIncluded = BaseResponse<{
export type ParticipationIncludedAttributes = {
category: string;
additionalInfo: any|null;
fromGroup: boolean;
} | {
label: string;
logoUrl: any|null;
}, {
} | SimpleUser

export type ParticipationIncludedRelationships = {
technicalUser: {
data: BaseObject[] | BaseObject | null;
};
person: {
data: BaseObject[] | BaseObject | null;
data: BaseObject<PersonType>[] | BaseObject<PersonType> | null;
};
}>
} | {
school: {
data: any
}
}

export type ParticipationIncluded = BaseResponse<ParticipationIncludedAttributes, ParticipationIncludedRelationships>
13 changes: 8 additions & 5 deletions src/models/Messagerie/UsersMailSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ export type UsersMailSettings = BaseResponse<{
maxCharsInCommunicationSubject: number;
}, {
folders: {
data: BaseObject[] | BaseObject | null;
data: BaseObject<'folder'>[];
};
signature: {
data: BaseObject<'signature'>
};
contacts: {
data: BaseObject[] | BaseObject | null;
data: BaseObject<'personContact' | 'groupContact'>[];
};
}, 'userMailSetting'>

export type PersonType = 'person' | 'student' | 'personInContactWithStudent' | 'nonTeachingStaff' | 'teacher'

export type UsersMailSettingsIncluded = BaseResponse<{
content?: string;
} | {
Expand All @@ -27,18 +29,19 @@ export type UsersMailSettingsIncluded = BaseResponse<{
linksWithUser: {
description: null | string;
additionalInfo: string[];
type: string;
type: ('SCHOOL' | 'FAMILY' | 'GROUP' | string);
studentId?: string;
schoolId?: string;
groupId?: string
}[] | null;
} | SimpleUser, {
parent?: {
data: BaseObject[] | BaseObject | null;
};
personContacts?: {
data: BaseObject[] | BaseObject | null;
data: BaseObject<'personContact'>[] | BaseObject<'personContact'> | null;
};
person?: {
data: BaseObject[] | BaseObject | null;
data: BaseObject<PersonType>[] | BaseObject<PersonType> | null;
};
}>
5 changes: 3 additions & 2 deletions src/models/School/SchoolInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PublicAttachment } from './Attachment'
import { BaseResponse, BaseObject } from '../Globals'
import { SimpleUser } from '../App/User'
import { PersonType } from '../Messagerie/UsersMailSettings'

export type SchoolInfoAttributes = {
publicationDateTime: string;
Expand Down Expand Up @@ -50,10 +51,10 @@ type SchoolInfoSchool = {
export type SchoolInfoIncludedAttributes = SimpleUser | PublicAttachment | SchoolInfoSchool | SchoolInfoAuthor
export type SchoolInfoIncludedRelationships = {
technicalUser: {
data: BaseObject | null;
data: BaseObject<'technicalUser'> | null;
};
person: {
data: BaseObject | null;
data: BaseObject<PersonType> | null;
};
}

Expand Down

0 comments on commit 784aa49

Please sign in to comment.