Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
52059c7
statistic method generated
bricekouetcheu Nov 15, 2022
59a1eb5
statistic resources created
bricekouetcheu Nov 15, 2022
124eca4
get statistics service
bricekouetcheu Nov 16, 2022
c8ce166
get statistics service
bricekouetcheu Nov 16, 2022
881d4bf
add images card
bricekouetcheu Nov 16, 2022
cd0a472
accomplissement service created
bricekouetcheu Dec 19, 2022
29712b7
statistic method generated
bricekouetcheu Nov 15, 2022
b5c54a6
statistic resources created
bricekouetcheu Nov 15, 2022
788499c
get statistics service
bricekouetcheu Nov 16, 2022
de881d2
get statistics service
bricekouetcheu Nov 16, 2022
88b0b94
add images card
bricekouetcheu Nov 16, 2022
53a2d69
accomplissement service
bricekouetcheu Dec 19, 2022
c929647
getting user stat service
bricekouetcheu Dec 19, 2022
707cc1b
statistic method generated
bricekouetcheu Nov 15, 2022
940e0e3
statistic resources created
bricekouetcheu Nov 15, 2022
65a5f97
get statistics service
bricekouetcheu Nov 16, 2022
a025625
get statistics service
bricekouetcheu Nov 16, 2022
f6aab45
add images card
bricekouetcheu Nov 16, 2022
bf35c9d
accomplissement service created
bricekouetcheu Dec 19, 2022
9143852
statistic method generated
bricekouetcheu Nov 15, 2022
b35089e
statistic resources created
bricekouetcheu Nov 15, 2022
57fe961
get statistics service
bricekouetcheu Nov 16, 2022
67e7495
get statistics service
bricekouetcheu Nov 16, 2022
5e817ac
getting user stat service
bricekouetcheu Dec 19, 2022
2e5fced
fix bug
bricekouetcheu Dec 19, 2022
73d35fa
fix conflit
bricekouetcheu Dec 20, 2022
2d538ca
card design + recovering userdata
bricekouetcheu Dec 20, 2022
b6159fd
fix ts bug + adding test component
bricekouetcheu Dec 20, 2022
c5a469d
statistic method generated
bricekouetcheu Nov 15, 2022
8c26179
statistic resources created
bricekouetcheu Nov 15, 2022
92c15b5
get statistics service
bricekouetcheu Nov 16, 2022
432bb13
get statistics service
bricekouetcheu Nov 16, 2022
b354932
add images card
bricekouetcheu Nov 16, 2022
d68f17b
accomplissement service created
bricekouetcheu Dec 19, 2022
d3c0c56
statistic method generated
bricekouetcheu Nov 15, 2022
37bc65e
statistic resources created
bricekouetcheu Nov 15, 2022
d6c3f38
get statistics service
bricekouetcheu Nov 16, 2022
82af867
get statistics service
bricekouetcheu Nov 16, 2022
d737c07
getting user stat service
bricekouetcheu Dec 19, 2022
8f13190
fix bug
bricekouetcheu Dec 19, 2022
c6f1a71
statistic method generated
bricekouetcheu Nov 15, 2022
d370f2b
statistic resources created
bricekouetcheu Nov 15, 2022
aa92936
get statistics service
bricekouetcheu Nov 16, 2022
30676aa
get statistics service
bricekouetcheu Nov 16, 2022
0618473
accomplissement service created
bricekouetcheu Dec 19, 2022
eb376bf
statistic method generated
bricekouetcheu Nov 15, 2022
eb7ba28
statistic resources created
bricekouetcheu Nov 15, 2022
e08f27e
get statistics service
bricekouetcheu Nov 16, 2022
3347e57
get statistics service
bricekouetcheu Nov 16, 2022
b474c3c
getting user stat service
bricekouetcheu Dec 19, 2022
123c06e
card design + recovering userdata
bricekouetcheu Dec 20, 2022
d81fd4f
fix ts bug + adding test component
bricekouetcheu Dec 20, 2022
524b84b
delete statistic ressource
bricekouetcheu Dec 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,534 changes: 1,404 additions & 10,130 deletions BACKEND/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions BACKEND/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"rxjs": "^7.6.0",
"swagger-ui-express": "^4.6.0",
"typeorm": "^0.3.11",
"webpack": "^5.75.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
Expand Down
30 changes: 30 additions & 0 deletions BACKEND/src/accomplissements/accomplissements.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AccomplissementsController } from './accomplissements.controller';
import { AccomplissementsService } from './accomplissements.service';

describe('AccomplissementsController', () => {
let controller: AccomplissementsController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [AccomplissementsController],
providers: [AccomplissementsService],
}).compile();

controller = module.get<AccomplissementsController>(
AccomplissementsController,
);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
function beforeEach(arg0: () => Promise<void>) {
throw new Error('Function not implemented.');
}

function expect(controller: AccomplissementsController) {
throw new Error('Function not implemented.');
}

47 changes: 47 additions & 0 deletions BACKEND/src/accomplissements/accomplissements.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
Controller,
Get,
Post,
Body,
Patch,
Param,
Delete,
} from '@nestjs/common';
import { AccomplissementsService } from './accomplissements.service';
import { CreateAccomplissementDto } from './dto/create-accomplissement.dto';
import { UpdateAccomplissementDto } from './dto/update-accomplissement.dto';

@Controller('accomplissements')
export class AccomplissementsController {
constructor(
private readonly accomplissementsService: AccomplissementsService,
) {}

@Post()
create(@Body() createAccomplissementDto: CreateAccomplissementDto) {
return this.accomplissementsService.create(createAccomplissementDto);
}

@Get()
findAll() {
return this.accomplissementsService.findAll();
}

@Get(':id')
findOne(@Param('id') id: string) {
return this.accomplissementsService.findOne(+id);
}

@Patch(':id')
update(
@Param('id') id: string,
@Body() updateAccomplissementDto: UpdateAccomplissementDto,
) {
return this.accomplissementsService.update(+id, updateAccomplissementDto);
}

@Delete(':id')
remove(@Param('id') id: string) {
return this.accomplissementsService.remove(+id);
}
}
12 changes: 12 additions & 0 deletions BACKEND/src/accomplissements/accomplissements.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Module } from '@nestjs/common';
import { AccomplissementsService } from './accomplissements.service';
import { AccomplissementsController } from './accomplissements.controller';
import { Accomplissements } from './entities/accomplissement.entity';
import { TypeOrmModule } from '@nestjs/typeorm';

@Module({
imports: [TypeOrmModule.forFeature([Accomplissements])],
controllers: [AccomplissementsController],
providers: [AccomplissementsService],
})
export class AccomplissementsModule {}
18 changes: 18 additions & 0 deletions BACKEND/src/accomplissements/accomplissements.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AccomplissementsService } from './accomplissements.service';

describe('AccomplissementsService', () => {
let service: AccomplissementsService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [AccomplissementsService],
}).compile();

service = module.get<AccomplissementsService>(AccomplissementsService);
});

it('should be defined', () => {
expect(service).toBeDefined();
});
});
36 changes: 36 additions & 0 deletions BACKEND/src/accomplissements/accomplissements.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { CreateAccomplissementDto } from './dto/create-accomplissement.dto';
import { UpdateAccomplissementDto } from './dto/update-accomplissement.dto';
import { Accomplissements } from './entities/accomplissement.entity';

@Injectable()
export class AccomplissementsService {

constructor(
@InjectRepository(Accomplissements)
private accomplissementRepository: Repository<Accomplissements>,
) {}
create(createAccomplissementDto: CreateAccomplissementDto) {
return 'This action adds a new accomplissement';
}

async findAll() {
const accomplissements = await this.accomplissementRepository.find();

return accomplissements;
}

findOne(id: number) {
return `This action returns a #${id} accomplissement`;
}

update(id: number, updateAccomplissementDto: UpdateAccomplissementDto) {
return `This action updates a #${id} accomplissement`;
}

remove(id: number) {
return `This action removes a #${id} accomplissement`;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class CreateAccomplissementDto {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PartialType } from '@nestjs/mapped-types';
import { CreateAccomplissementDto } from './create-accomplissement.dto';

export class UpdateAccomplissementDto extends PartialType(CreateAccomplissementDto) {}
22 changes: 22 additions & 0 deletions BACKEND/src/accomplissements/entities/accomplissement.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Accomplissements {
@PrimaryGeneratedColumn('increment')
id: number;

@Column()
Target: string;

@Column()
Titre: string;

@Column()
Description: string;

@Column()
Resultat: number;

@Column({ nullable: true })
image: string;
}
2 changes: 2 additions & 0 deletions BACKEND/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { DragModule } from './drag_and_drop/drag_and_drop.module';
import { CardsThemeModule } from './cards_theme/cards_theme.module';
import { LevelMapModule } from './level_map/level_map.module';
import { LevelDifficultyModule } from './level_difficulty/level_difficulty.module';
import { AccomplissementsModule } from './accomplissements/accomplissements.module';

@Module({
imports: [
Expand Down Expand Up @@ -62,6 +63,7 @@ import { LevelDifficultyModule } from './level_difficulty/level_difficulty.modul
DragModule,
LevelMapModule,
UserResponseModule,
AccomplissementsModule,
],
controllers: [AppController],
providers: [AppService],
Expand Down
6 changes: 3 additions & 3 deletions BACKEND/src/schoolclass/schoolclass.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { School } from './../school/entities/school.entity';
import { Schoolclass } from './entities/schoolclass.entity';
import { Repository } from 'typeorm';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { School } from 'src/school/entities/school.entity';
import { Repository } from 'typeorm';
import { CreateSchoolclassDto } from './dto/create-schoolclass.dto';
import { UpdateSchoolclassDto } from './dto/update-schoolclass.dto';
import { Schoolclass } from './entities/schoolclass.entity';

@Injectable()
export class SchoolclassService {
Expand Down
67 changes: 0 additions & 67 deletions BACKEND/src/statistic/statistic.service.ts

This file was deleted.

1 change: 1 addition & 0 deletions BACKEND/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface UserData {
schoolClass: string[];
school: string;
sex: string;
infos: object;
}
export interface Card {
id: number;
Expand Down
1 change: 1 addition & 0 deletions BACKEND/src/user_response/user_response.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { Module } from '@nestjs/common';
import { UserResponseService } from './user_response.service';
import { UserResponseController } from './user_response.controller';
Expand Down
6 changes: 6 additions & 0 deletions BACKEND/src/users/entities/users.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import {
JoinTable,
ManyToMany,
ManyToOne,
OneToMany,
OneToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { Role } from '../../role/entities/role.entity';
import { Schoolclass } from '../../schoolclass/entities/schoolclass.entity';
import { Lang } from '../../lang/entities/lang.entity';

@Entity()
export class Users {
@PrimaryGeneratedColumn('increment')
Expand All @@ -35,6 +38,9 @@ export class Users {
@Column()
sex: string;

@Column('jsonb', { nullable: true })
infos: object[];

@ManyToMany(() => Role)
@JoinTable()
role: Role[];
Expand Down
2 changes: 0 additions & 2 deletions BACKEND/src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { ApiParam } from '@nestjs/swagger';
import { Param } from '@nestjs/common';


@Controller('users')
export class UsersController {
constructor(private readonly usersService: UsersService) {}
Expand Down Expand Up @@ -65,5 +64,4 @@ export class UsersController {
findActivePlayersCount(@Param('id_user') id_user: number) {
return this.usersService.findActivePlayersCount(+id_user);
}

}
1 change: 1 addition & 0 deletions BACKEND/src/users/users.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Schoolclass } from '../schoolclass/entities/schoolclass.entity';
import { Users } from './entities/users.entity';
import { Module } from '@nestjs/common';
import { UsersService } from './users.service';

import { SchoolModule } from '../school/school.module';
import { SchoolclassModule } from '../schoolclass/schoolclass.module';
import { RoleModule } from '../role/role.module';
Expand Down
12 changes: 7 additions & 5 deletions BACKEND/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class UsersService {
}),
school: user.schoolclass[0].school.name, //Lutilisateur ne fréquente qu'une seule école
sex: user.sex,
infos: user.infos,
};
})
.catch((err) => {
Expand Down Expand Up @@ -111,6 +112,7 @@ export class UsersService {
schoolClass: [],
school: 'Institut Saint Joseph',
sex: 'M',
infos: user.infos,
};
})
.catch((err) => {
Expand Down Expand Up @@ -268,9 +270,9 @@ export class UsersService {
async findSubscriptionStats(userId: number): Promise<Users | undefined> {
const subscriptionStats = this.userRepository.query(
`select school.name || ' - ' ||schoolclass."name" as SchoolClass_name,count(*) from schoolclass
join users_school_class_schoolclass on schoolclass.id=users_school_class_schoolclass."schoolclassId"
join users_schoolclass_schoolclass on schoolclass.id=users_schoolclass_schoolclass."schoolclassId"
join school on school.id = schoolclass."schoolId"
where school.id in (select schoolclass."schoolId" from schoolclass where schoolclass.id in (select users_school_class_schoolclass."schoolclassId" from users_school_class_schoolclass where users_school_class_schoolclass."usersId"=${userId}))
where school.id in (select schoolclass."schoolId" from schoolclass where schoolclass.id in (select users_schoolclass_schoolclass."schoolclassId" from users_schoolclass_schoolclass where users_schoolclass_schoolclass."usersId"=${userId}))
group by school.name,schoolclass.name;`,
);
return await subscriptionStats;
Expand All @@ -280,10 +282,10 @@ export class UsersService {
const subscriptionStats = this.userRepository.query(
`select A.name,count(*) from
(select distinct user_response."userId", schoolclass."name" as name from user_response
left join users_school_class_schoolclass on user_response."userId"=users_school_class_schoolclass."usersId"
left join schoolclass on schoolclass.id=users_school_class_schoolclass."schoolclassId"
left join users_schoolclass_schoolclass on user_response."userId"=users_schoolclass_schoolclass."usersId"
left join schoolclass on schoolclass.id=users_schoolclass_schoolclass."schoolclassId"
left join school on school.id = schoolclass."schoolId"
where school.id in (select schoolclass."schoolId" from schoolclass where schoolclass.id in (select users_school_class_schoolclass."schoolclassId" from users_school_class_schoolclass where users_school_class_schoolclass."usersId"=${userId}))
where school.id in (select schoolclass."schoolId" from schoolclass where schoolclass.id in (select users_schoolclass_schoolclass."schoolclassId" from users_schoolclass_schoolclass where users_schoolclass_schoolclass."usersId"=${userId}))
group by user_response."userId",schoolclass.name) as A
group by A.name`,
);
Expand Down
Loading