Fix toolbar and reformat backend code
This commit is contained in:
parent
30433e5985
commit
2a7aa2a65a
18 changed files with 729 additions and 728 deletions
|
@ -24,7 +24,8 @@ import {CourseRepository} from '../repositories';
|
||||||
export class CourseRequirementController {
|
export class CourseRequirementController {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(CourseRepository) protected courseRepository: CourseRepository,
|
@repository(CourseRepository) protected courseRepository: CourseRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@get('/courses/{id}/requirements', {
|
@get('/courses/{id}/requirements', {
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
@ -16,7 +16,8 @@ export class CourseSubjectController {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(CourseRepository)
|
@repository(CourseRepository)
|
||||||
public courseRepository: CourseRepository,
|
public courseRepository: CourseRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@get('/courses/{id}/subject', {
|
@get('/courses/{id}/subject', {
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
@ -24,7 +24,8 @@ import {CourseRepository} from '../repositories';
|
||||||
export class CourseUserController {
|
export class CourseUserController {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(CourseRepository) protected courseRepository: CourseRepository,
|
@repository(CourseRepository) protected courseRepository: CourseRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@get('/courses/{id}/users', {
|
@get('/courses/{id}/users', {
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
@ -24,7 +24,8 @@ import {SubjectRepository} from '../repositories';
|
||||||
export class SubjectCourseController {
|
export class SubjectCourseController {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(SubjectRepository) protected subjectRepository: SubjectRepository,
|
@repository(SubjectRepository) protected subjectRepository: SubjectRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@get('/subjects/{id}/courses', {
|
@get('/subjects/{id}/courses', {
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
@ -24,7 +24,8 @@ import {UserRepository} from '../repositories';
|
||||||
export class UserCourseController {
|
export class UserCourseController {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(UserRepository) protected userRepository: UserRepository,
|
@repository(UserRepository) protected userRepository: UserRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
@get('/users/{id}/courses', {
|
@get('/users/{id}/courses', {
|
||||||
responses: {
|
responses: {
|
||||||
|
|
|
@ -199,9 +199,10 @@ export class UserController {
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (id === +this.user.id) {
|
if (id === +this.user.id) {
|
||||||
const loggedInUser = await this.userService.findUserById(this.user.id);
|
const loggedInUser = await this.userService.findUserById(this.user.id);
|
||||||
if(user.isAdmin !== undefined && loggedInUser.isAdmin !== user.isAdmin)
|
if (user.isAdmin !== undefined && loggedInUser.isAdmin !== user.isAdmin) {
|
||||||
throw new HttpErrors.BadRequest('Cannot change admin status of self');
|
throw new HttpErrors.BadRequest('Cannot change admin status of self');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
await this.userRepository.updateById(id, user);
|
await this.userRepository.updateById(id, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,9 @@ import {DefaultCrudRepository} from '@loopback/repository';
|
||||||
import { DatabaseDataSource } from '../datasources';
|
import { DatabaseDataSource } from '../datasources';
|
||||||
import { CourseUser, CourseUserRelations } from '../models';
|
import { CourseUser, CourseUserRelations } from '../models';
|
||||||
|
|
||||||
export class CourseUserRepository extends DefaultCrudRepository<
|
export class CourseUserRepository extends DefaultCrudRepository<CourseUser,
|
||||||
CourseUser,
|
|
||||||
typeof CourseUser.prototype.id,
|
typeof CourseUser.prototype.id,
|
||||||
CourseUserRelations
|
CourseUserRelations> {
|
||||||
> {
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject('datasources.database') dataSource: DatabaseDataSource,
|
@inject('datasources.database') dataSource: DatabaseDataSource,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import { inject, Getter } from '@loopback/core';
|
import { inject, Getter } from '@loopback/core';
|
||||||
import {DefaultCrudRepository, repository, BelongsToAccessor, HasManyThroughRepositoryFactory, HasManyRepositoryFactory} from '@loopback/repository';
|
import {
|
||||||
|
DefaultCrudRepository,
|
||||||
|
repository,
|
||||||
|
BelongsToAccessor,
|
||||||
|
HasManyThroughRepositoryFactory,
|
||||||
|
HasManyRepositoryFactory
|
||||||
|
} from '@loopback/repository';
|
||||||
import { DatabaseDataSource } from '../datasources';
|
import { DatabaseDataSource } from '../datasources';
|
||||||
import { Course, CourseRelations, Subject, User, CourseUser, Requirement } from '../models';
|
import { Course, CourseRelations, Subject, User, CourseUser, Requirement } from '../models';
|
||||||
import { SubjectRepository } from './subject.repository';
|
import { SubjectRepository } from './subject.repository';
|
||||||
|
@ -7,18 +13,15 @@ import {CourseUserRepository} from './course-user.repository';
|
||||||
import { UserRepository } from './user.repository';
|
import { UserRepository } from './user.repository';
|
||||||
import { RequirementRepository } from './requirement.repository';
|
import { RequirementRepository } from './requirement.repository';
|
||||||
|
|
||||||
export class CourseRepository extends DefaultCrudRepository<
|
export class CourseRepository extends DefaultCrudRepository<Course,
|
||||||
Course,
|
|
||||||
typeof Course.prototype.id,
|
typeof Course.prototype.id,
|
||||||
CourseRelations
|
CourseRelations> {
|
||||||
> {
|
|
||||||
|
|
||||||
public readonly subject: BelongsToAccessor<Subject, typeof Course.prototype.id>;
|
public readonly subject: BelongsToAccessor<Subject, typeof Course.prototype.id>;
|
||||||
|
|
||||||
public readonly users: HasManyThroughRepositoryFactory<User, typeof User.prototype.id,
|
public readonly users: HasManyThroughRepositoryFactory<User, typeof User.prototype.id,
|
||||||
CourseUser,
|
CourseUser,
|
||||||
typeof Course.prototype.id
|
typeof Course.prototype.id>;
|
||||||
>;
|
|
||||||
|
|
||||||
public readonly requirements: HasManyRepositoryFactory<Requirement, typeof Course.prototype.id>;
|
public readonly requirements: HasManyRepositoryFactory<Requirement, typeof Course.prototype.id>;
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,9 @@ import {DefaultCrudRepository} from '@loopback/repository';
|
||||||
import { DatabaseDataSource } from '../datasources';
|
import { DatabaseDataSource } from '../datasources';
|
||||||
import { Requirement, RequirementRelations } from '../models';
|
import { Requirement, RequirementRelations } from '../models';
|
||||||
|
|
||||||
export class RequirementRepository extends DefaultCrudRepository<
|
export class RequirementRepository extends DefaultCrudRepository<Requirement,
|
||||||
Requirement,
|
|
||||||
typeof Requirement.prototype.id,
|
typeof Requirement.prototype.id,
|
||||||
RequirementRelations
|
RequirementRelations> {
|
||||||
> {
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject('datasources.database') dataSource: DatabaseDataSource,
|
@inject('datasources.database') dataSource: DatabaseDataSource,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -5,11 +5,9 @@ import {Subject, SubjectRelations, Course} from '../models';
|
||||||
import { UserRepository } from './user.repository';
|
import { UserRepository } from './user.repository';
|
||||||
import { CourseRepository } from './course.repository';
|
import { CourseRepository } from './course.repository';
|
||||||
|
|
||||||
export class SubjectRepository extends DefaultCrudRepository<
|
export class SubjectRepository extends DefaultCrudRepository<Subject,
|
||||||
Subject,
|
|
||||||
typeof Subject.prototype.id,
|
typeof Subject.prototype.id,
|
||||||
SubjectRelations
|
SubjectRelations> {
|
||||||
> {
|
|
||||||
|
|
||||||
public readonly courses: HasManyRepositoryFactory<Course, typeof Subject.prototype.id>;
|
public readonly courses: HasManyRepositoryFactory<Course, typeof Subject.prototype.id>;
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,13 @@ import {SubjectRepository} from './subject.repository';
|
||||||
import { CourseUserRepository } from './course-user.repository';
|
import { CourseUserRepository } from './course-user.repository';
|
||||||
import { CourseRepository } from './course.repository';
|
import { CourseRepository } from './course.repository';
|
||||||
|
|
||||||
export class UserRepository extends DefaultTransactionalRepository<
|
export class UserRepository extends DefaultTransactionalRepository<User,
|
||||||
User,
|
|
||||||
typeof User.prototype.id,
|
typeof User.prototype.id,
|
||||||
UserRelations
|
UserRelations> {
|
||||||
> {
|
|
||||||
|
|
||||||
public readonly courses: HasManyThroughRepositoryFactory<Course, typeof Course.prototype.id,
|
public readonly courses: HasManyThroughRepositoryFactory<Course, typeof Course.prototype.id,
|
||||||
CourseUser,
|
CourseUser,
|
||||||
typeof User.prototype.id
|
typeof User.prototype.id>;
|
||||||
>;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject('datasources.database') dataSource: DatabaseDataSource, @repository.getter('SubjectRepository') protected subjectRepositoryGetter: Getter<SubjectRepository>, @repository.getter('CourseUserRepository') protected courseUserRepositoryGetter: Getter<CourseUserRepository>, @repository.getter('CourseRepository') protected courseRepositoryGetter: Getter<CourseRepository>,
|
@inject('datasources.database') dataSource: DatabaseDataSource, @repository.getter('SubjectRepository') protected subjectRepositoryGetter: Getter<SubjectRepository>, @repository.getter('CourseUserRepository') protected courseUserRepositoryGetter: Getter<CourseUserRepository>, @repository.getter('CourseRepository') protected courseRepositoryGetter: Getter<CourseRepository>,
|
||||||
|
|
|
@ -23,7 +23,8 @@ export type Credentials = {
|
||||||
export class SzakdolgozatUserService implements UserService<User, Credentials> {
|
export class SzakdolgozatUserService implements UserService<User, Credentials> {
|
||||||
constructor(
|
constructor(
|
||||||
@repository(UserRepository) public userRepository: UserRepository,
|
@repository(UserRepository) public userRepository: UserRepository,
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
async verifyCredentials(credentials: Credentials): Promise<User> {
|
async verifyCredentials(credentials: Credentials): Promise<User> {
|
||||||
const invalidCredentialsError = 'Invalid email or password.';
|
const invalidCredentialsError = 'Invalid email or password.';
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
</mat-sidenav>
|
</mat-sidenav>
|
||||||
<mat-sidenav-content>
|
<mat-sidenav-content>
|
||||||
<mat-toolbar color="primary">
|
<mat-toolbar color="primary" style="z-index: 1000">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Oldalsáv"
|
aria-label="Oldalsáv"
|
||||||
|
|
Loading…
Reference in a new issue