Skip to content

Commit edf7e24

Browse files
committed
Logging before stuff happens for improved debugging, newer compilation output
1 parent d110118 commit edf7e24

15 files changed

Lines changed: 178 additions & 187 deletions

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ If you found a bug or have an idea for a feature, simply [submit an issue](https
271271
The tilt repository ships with a [docker-compose.yml](docker-compose.yml), which includes a sample setup with MariaDB, the test SMTP server [MailDev](https://github.com/maildev/maildev) and phpMyAdmin. To mimic the proxy'd setup, it also includes build instructions for a tilt container, as well as an NGINX container. You usually only need `db`, `phpmyadmin` and `maildev`, therefore it's sufficient to start them using:
272272

273273
```bash
274-
$ docker compose up db phpmyadmin maildev
274+
docker compose up db phpmyadmin maildev
275275
```
276276

277277
For local development, the backend supports reading `.env` files. Refer to [`.env.example`](backend/.env.example) for such a configuration and match the ports from the Docker Compose configuration.
@@ -283,13 +283,13 @@ cp backend/.env.example backend/.env
283283
You can then start the backend using:
284284

285285
```bash
286-
$ yarn backend::start
286+
yarn backend::start
287287
```
288288

289-
As the frontend is built in modern React, we use [Webpack](https://webpack.js.org) and its devserver to develop. The backend runs on a different port, so we need to tell the frontend how to reach the backend. This can be done through the `API_BASE_URL` environment variable. To start the frontend devserver with the backend listening on port 3000, simply provide it using:
289+
As the frontend is built in modern React, we use [Webpack](https://webpack.js.org) and its devserver to develop. Visit localhost:8080 in your browser to view it. The backend runs on a different port, so we need to tell the frontend how to reach the backend. This can be done through the `API_BASE_URL` environment variable. To start the frontend devserver with the backend listening on port 3000, simply provide it using:
290290

291291
```bash
292-
$ API_BASE_URL=http://localhost:3000/api yarn frontend::start
292+
API_BASE_URL=http://localhost:3000/api yarn frontend::start
293293
```
294294

295295
We also provide a set of utility scripts in our [package.json](package.json)'s `script` section, such as linting, formatting and type-checking.

backend/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LOG_FILENAME=tilt.log
88

99
# mail config
1010
MAIL_HOST=localhost
11-
MAIL_PORT=465
11+
MAIL_PORT=2525 # use 465 for encryption
1212
MAIL_USERNAME=root@localhost
1313
MAIL_PASSWORD=password
1414

backend/src/controllers/dto.ts

Lines changed: 111 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,15 @@ export const convertBetweenEntityAndDTO = <TOutput>(
5858
outputClass: ClassDeclaration<TOutput>,
5959
): TOutput => plainToClass(outputClass, [input])[0];
6060

61-
export class SettingsDTO implements DTO<Omit<Settings, "updatedAt">> {
62-
@Type(() => ApplicationSettingsDTO)
63-
@ValidateNested()
64-
@Expose()
65-
public application!: ApplicationSettingsDTO;
66-
@Type(() => FrontendSettingsDTO)
67-
@ValidateNested()
61+
export class FormSettingsDTO implements DTO<FormSettings> {
62+
@IsString()
6863
@Expose()
69-
public frontend!: FrontendSettingsDTO;
70-
@Type(() => EmailSettingsDTO)
71-
@ValidateNested()
64+
public title!: string;
65+
@IsArray()
66+
@Type(() => QuestionDTO)
67+
@ValidateNested({ each: true })
7268
@Expose()
73-
public email!: EmailSettingsDTO;
69+
public questions!: QuestionDTO[];
7470
}
7571

7672
export class ApplicationSettingsDTO implements DTO<ApplicationSettings> {
@@ -95,15 +91,72 @@ export class ApplicationSettingsDTO implements DTO<ApplicationSettings> {
9591
public hoursToConfirm!: number;
9692
}
9793

98-
export class FormSettingsDTO implements DTO<FormSettings> {
94+
export class FrontendSettingsDTO implements DTO<FrontendSettings> {
95+
@IsHexColor()
96+
@Expose()
97+
public colorGradientStart!: string;
98+
@IsHexColor()
99+
@Expose()
100+
public colorGradientEnd!: string;
101+
@IsHexColor()
102+
@Expose()
103+
public colorLink!: string;
104+
@IsHexColor()
105+
@Expose()
106+
public colorLinkHover!: string;
107+
@IsUrl()
108+
@Expose()
109+
public loginSignupImage!: string;
110+
@IsUrl()
111+
@Expose()
112+
public sidebarImage!: string;
113+
}
114+
115+
export class EmailTemplateDTO implements DTO<EmailTemplate> {
99116
@IsString()
100117
@Expose()
101-
public title!: string;
102-
@IsArray()
103-
@Type(() => QuestionDTO)
104-
@ValidateNested({ each: true })
118+
public subject!: string;
119+
@IsString()
105120
@Expose()
106-
public questions!: QuestionDTO[];
121+
@MaxLength(EmailTemplateSize)
122+
public htmlTemplate!: string;
123+
@IsString()
124+
@Expose()
125+
@MaxLength(EmailTemplateSize)
126+
public textTemplate!: string;
127+
}
128+
129+
export class EmailSettingsDTO implements DTO<EmailSettings> {
130+
@IsString()
131+
@Expose()
132+
public sender!: string;
133+
@Type(() => EmailTemplateDTO)
134+
@ValidateNested()
135+
@Expose()
136+
public verifyEmail!: EmailTemplateDTO;
137+
@Type(() => EmailTemplateDTO)
138+
@ValidateNested()
139+
@Expose()
140+
public forgotPasswordEmail!: EmailTemplateDTO;
141+
@Type(() => EmailTemplateDTO)
142+
@ValidateNested()
143+
@Expose()
144+
public admittedEmail!: EmailTemplateDTO;
145+
}
146+
147+
export class SettingsDTO implements DTO<Omit<Settings, "updatedAt">> {
148+
@Type(() => ApplicationSettingsDTO)
149+
@ValidateNested()
150+
@Expose()
151+
public application!: ApplicationSettingsDTO;
152+
@Type(() => FrontendSettingsDTO)
153+
@ValidateNested()
154+
@Expose()
155+
public frontend!: FrontendSettingsDTO;
156+
@Type(() => EmailSettingsDTO)
157+
@ValidateNested()
158+
@Expose()
159+
public email!: EmailSettingsDTO;
107160
}
108161

109162
export abstract class QuestionConfigurationDTOBase {
@@ -235,59 +288,6 @@ export class QuestionDTO<TQuestionConfigurationDTO = IQuestionConfiguration>
235288
public showIfParentHasValue!: string | null;
236289
}
237290

238-
export class FrontendSettingsDTO implements DTO<FrontendSettings> {
239-
@IsHexColor()
240-
@Expose()
241-
public colorGradientStart!: string;
242-
@IsHexColor()
243-
@Expose()
244-
public colorGradientEnd!: string;
245-
@IsHexColor()
246-
@Expose()
247-
public colorLink!: string;
248-
@IsHexColor()
249-
@Expose()
250-
public colorLinkHover!: string;
251-
@IsUrl()
252-
@Expose()
253-
public loginSignupImage!: string;
254-
@IsUrl()
255-
@Expose()
256-
public sidebarImage!: string;
257-
}
258-
259-
export class EmailSettingsDTO implements DTO<EmailSettings> {
260-
@IsString()
261-
@Expose()
262-
public sender!: string;
263-
@Type(() => EmailTemplateDTO)
264-
@ValidateNested()
265-
@Expose()
266-
public verifyEmail!: EmailTemplateDTO;
267-
@Type(() => EmailTemplateDTO)
268-
@ValidateNested()
269-
@Expose()
270-
public forgotPasswordEmail!: EmailTemplateDTO;
271-
@Type(() => EmailTemplateDTO)
272-
@ValidateNested()
273-
@Expose()
274-
public admittedEmail!: EmailTemplateDTO;
275-
}
276-
277-
export class EmailTemplateDTO implements DTO<EmailTemplate> {
278-
@IsString()
279-
@Expose()
280-
public subject!: string;
281-
@IsString()
282-
@Expose()
283-
@MaxLength(EmailTemplateSize)
284-
public htmlTemplate!: string;
285-
@IsString()
286-
@Expose()
287-
@MaxLength(EmailTemplateSize)
288-
public textTemplate!: string;
289-
}
290-
291291
export class UpdateSettingsRequestDTO implements IApiRequest<SettingsDTO> {
292292
@Type(() => SettingsDTO)
293293
@ValidateNested()
@@ -345,6 +345,11 @@ export class PasswordResetRequestDTO implements IApiRequest<PasswordResetDTO> {
345345
public data!: PasswordResetDTO;
346346
}
347347

348+
export class ForgotPasswordDTO {
349+
@Expose()
350+
public email!: string;
351+
}
352+
348353
export class ForgotPasswordRequestDTO
349354
implements IApiRequest<ForgotPasswordDTO>
350355
{
@@ -353,11 +358,6 @@ export class ForgotPasswordRequestDTO
353358
public data!: ForgotPasswordDTO;
354359
}
355360

356-
export class ForgotPasswordDTO {
357-
@Expose()
358-
public email!: string;
359-
}
360-
361361
export class SignupResponseDTO {
362362
@Expose()
363363
public email!: string;
@@ -384,6 +384,42 @@ export class UserDetailsRepsonseDTO {
384384
public role!: UserRole;
385385
}
386386

387+
export class UserDTO {
388+
@Expose()
389+
public id!: number;
390+
@Expose()
391+
public email!: string;
392+
@Expose()
393+
public firstName!: string;
394+
@Expose()
395+
public lastName!: string;
396+
@Expose()
397+
public createdAt!: Date;
398+
@Transform(
399+
({ obj: rawObj }) => {
400+
const obj = rawObj as User;
401+
return !obj.verifyToken;
402+
},
403+
{ toClassOnly: true },
404+
)
405+
@Expose()
406+
public isVerified!: boolean;
407+
@Expose()
408+
public role!: UserRole;
409+
@Expose()
410+
public initialProfileFormSubmittedAt!: Date | null;
411+
@Expose()
412+
public confirmationExpiresAt!: Date | null;
413+
@Expose()
414+
public admitted!: boolean;
415+
@Expose()
416+
public confirmed!: boolean;
417+
@Expose()
418+
public declined!: boolean;
419+
@Expose()
420+
public checkedIn!: boolean;
421+
}
422+
387423
export class UserTokenResponseDTO {
388424
@Expose()
389425
public token!: string;
@@ -431,42 +467,6 @@ export class StoreAnswersRequestDTO
431467
public data!: readonly AnswerDTO[];
432468
}
433469

434-
export class UserDTO {
435-
@Expose()
436-
public id!: number;
437-
@Expose()
438-
public email!: string;
439-
@Expose()
440-
public firstName!: string;
441-
@Expose()
442-
public lastName!: string;
443-
@Expose()
444-
public createdAt!: Date;
445-
@Transform(
446-
({ obj: rawObj }) => {
447-
const obj = rawObj as User;
448-
return !obj.verifyToken;
449-
},
450-
{ toClassOnly: true },
451-
)
452-
@Expose()
453-
public isVerified!: boolean;
454-
@Expose()
455-
public role!: UserRole;
456-
@Expose()
457-
public initialProfileFormSubmittedAt!: Date | null;
458-
@Expose()
459-
public confirmationExpiresAt!: Date | null;
460-
@Expose()
461-
public admitted!: boolean;
462-
@Expose()
463-
public confirmed!: boolean;
464-
@Expose()
465-
public declined!: boolean;
466-
@Expose()
467-
public checkedIn!: boolean;
468-
}
469-
470470
export class ApplicationDTO {
471471
@Expose()
472472
@Type(() => UserDTO)

backend/src/controllers/users-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class UsersController {
4040
public constructor(
4141
@Inject(UserServiceToken) private readonly _users: IUserService,
4242
@Inject(ApplicationServiceToken)
43-
private readonly _applications: IApplicationService,
43+
private readonly _applications: IApplicationService
4444
) {}
4545

4646
/**

backend/src/entities/settings.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,6 @@ import {
99
} from "typeorm";
1010
import { ApplicationSettings } from "./application-settings";
1111

12-
@Entity()
13-
export class Settings {
14-
@PrimaryGeneratedColumn()
15-
public readonly id!: number;
16-
@UpdateDateColumn()
17-
public readonly updatedAt!: Date;
18-
@Type(() => ApplicationSettings)
19-
@OneToOne(() => ApplicationSettings, { cascade: true, eager: true })
20-
@JoinColumn()
21-
public application!: ApplicationSettings;
22-
@Type(() => FrontendSettings)
23-
@Column(() => FrontendSettings)
24-
public frontend!: FrontendSettings;
25-
@Type(() => EmailSettings)
26-
@Column(() => EmailSettings)
27-
public email!: EmailSettings;
28-
}
29-
3012
export class FrontendSettings {
3113
@Column()
3214
public colorGradientStart!: string;
@@ -42,6 +24,15 @@ export class FrontendSettings {
4224
public sidebarImage!: string;
4325
}
4426

27+
export class EmailTemplate {
28+
@Column()
29+
public subject!: string;
30+
@Column("text")
31+
public htmlTemplate!: string;
32+
@Column("text")
33+
public textTemplate!: string;
34+
}
35+
4536
export class EmailSettings {
4637
@Column()
4738
public sender!: string;
@@ -55,13 +46,22 @@ export class EmailSettings {
5546
public forgotPasswordEmail!: EmailTemplate;
5647
}
5748

58-
export class EmailTemplate {
59-
@Column()
60-
public subject!: string;
61-
@Column("text")
62-
public htmlTemplate!: string;
63-
@Column("text")
64-
public textTemplate!: string;
49+
@Entity()
50+
export class Settings {
51+
@PrimaryGeneratedColumn()
52+
public readonly id!: number;
53+
@UpdateDateColumn()
54+
public readonly updatedAt!: Date;
55+
@Type(() => ApplicationSettings)
56+
@OneToOne(() => ApplicationSettings, { cascade: true, eager: true })
57+
@JoinColumn()
58+
public application!: ApplicationSettings;
59+
@Type(() => FrontendSettings)
60+
@Column(() => FrontendSettings)
61+
public frontend!: FrontendSettings;
62+
@Type(() => EmailSettings)
63+
@Column(() => EmailSettings)
64+
public email!: EmailSettings;
6565
}
6666

6767
/**

0 commit comments

Comments
 (0)