Skip to content

Commit

Permalink
merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
sh977218 committed Dec 28, 2024
2 parents d16e3cd + 0c48ff4 commit 5e5956e
Show file tree
Hide file tree
Showing 21 changed files with 243 additions and 119 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
'.eslintrc.js',
'scripts',
'build',
'dist',
'coverage.webpack.js',
'karma.conf.js',
'tailwind.config.js',
Expand Down Expand Up @@ -112,7 +113,7 @@ module.exports = {
},
},
{
files: ['server/**/*.ts'],
files: ['{server,test}/**/*.ts'],
parserOptions: {
project: 'server/tsconfig.json',
tsconfigRootDir: __dirname,
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/pr-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,7 @@ jobs:
run: |
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
sudo apt install ./mongodb-database-tools-*-100.6.1.deb
- run: mongoimport test/heroes.json # TODO find a way to run this inside the mongo service container, then the `Setup mongodb-tools` would not be needed neither

- name: Create es index
run: curl -X PUT localhost:9200/heroes
- name: Update index to have 0 replicas # TODO es create 1 repl set per node by default, index status is yellow.
run: |
curl -X PUT http://localhost:9200/heroes/_settings -H "Content-Type: application/json" -d '{
"index" : {
"number_of_replicas" : 0
}
}'
- name: Inject data into es
run: |
curl -X PUT http://localhost:9200/heroes/_create/1 -H "Content-Type: application/json" -d @test/heroes.json
- run: mongoimport test/heroes.json --jsonArray # TODO find a way to run this inside the mongo service container, then the `Setup mongodb-tools` would not be needed neither

- name: Install dependencies
run: npm i
Expand Down
9 changes: 0 additions & 9 deletions client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
"simple-web-site/src/public"
],
"styles": [
{
"input": "simple-web-site/src/theme.scss"
},
"simple-web-site/src/styles.scss"
],
"scripts": []
Expand Down Expand Up @@ -86,9 +83,6 @@
"simple-web-site/src/public"
],
"styles": [
{
"input": "simple-web-site/src/theme.scss"
},
"simple-web-site/src/styles.scss"
],
"scripts": []
Expand Down Expand Up @@ -125,9 +119,6 @@
"simple-web-site/src/public"
],
"styles": [
{
"input": "simple-web-site/src/theme.scss"
},
"simple-web-site/src/styles.scss"
],
"scripts": [],
Expand Down
41 changes: 27 additions & 14 deletions client/simple-web-site/src/app/hero/hero.component.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
<mat-card>
<mat-card-header>
<mat-card-title
><a
class="underline"
routerLink="/search"
[queryParams]="{ q: hero().homeTown }"
>{{ hero().homeTown }}</a
>
><a
class="underline"
routerLink="/search"
[queryParams]="{ q: hero().homeTown }"
>{{ hero().homeTown }}</a
>
</mat-card-title>
<mat-card-subtitle>{{ hero().squadName }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>{{ hero().secretBase }}</p>
<p>{{ hero().content }}</p>
<mat-list>
<mat-list-item *ngFor="let member of hero()?.members || []">
<p>{{ member.name }}</p>
<p>{{ member.age }}</p>
<p>{{ member.powers }}</p>
<p>{{ member.secretIdentity }}</p>
</mat-list-item>
</mat-list>
<div *ngFor="let member of hero()?.members || []" class="my-2 border-solid border-2">
<mat-list>
<mat-list-item>
<span matListItemTitle>member name</span>
<span matListItemLine>{{ member.name }}</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>member age</span>
<span matListItemLine>{{ member.age }}</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>member powers</span>
<span matListItemLine>{{ member.powers }}</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>member secretIdentity</span>
<span matListItemLine>{{ member.secretIdentity }}</span>
</mat-list-item>
</mat-list>
</div>
</mat-card-content>
</mat-card>
19 changes: 4 additions & 15 deletions client/simple-web-site/src/app/hero/hero.component.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { NgForOf } from '@angular/common';
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import {
MatCard,
MatCardContent,
MatCardHeader,
MatCardSubtitle,
MatCardTitle,
} from '@angular/material/card';
import { MatList, MatListItem } from '@angular/material/list';
import { MatCardModule } from '@angular/material/card';
import { MatListModule } from '@angular/material/list';
import { RouterLink } from '@angular/router';

import { Hero } from '../model/hero';
Expand All @@ -16,15 +10,10 @@ import { Hero } from '../model/hero';
selector: 'app-hero',
standalone: true,
imports: [
MatCard,
MatCardContent,
MatCardHeader,
MatCardSubtitle,
MatCardTitle,
MatList,
MatListItem,
NgForOf,
RouterLink,
MatCardModule,
MatListModule,
],
templateUrl: './hero.component.html',
styleUrl: './hero.component.scss',
Expand Down
14 changes: 8 additions & 6 deletions client/simple-web-site/src/app/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@
<mat-divider></mat-divider>

<div class="flex">
<div class="flex-grow" data-testid="esResult">
<div class="flex-grow basis-0" data-testid="esResult">
<h1>Search Result From ES:</h1>
<section class="flex flex-wrap justify-between">
<section class="flex flex-col flex-wrap justify-between">
<ng-container *ngFor="let hero of heroesFromES$ | async">
<app-hero [hero]="hero"></app-hero>
<app-hero [hero]="hero" class="my-2"></app-hero>
<mat-divider></mat-divider>
</ng-container>
</section>
</div>
<div class="flex-grow" data-testid="mongoResult">
<div class="flex-grow basis-0" data-testid="mongoResult">
<h1 class="flex">Search Result From Mongo:</h1>
<section class="flex flex-wrap justify-between">
<section class="flex flex-col flex-wrap justify-between">
<ng-container *ngFor="let hero of heroesFromMongo$ | async">
<app-hero [hero]="hero"></app-hero>
<app-hero [hero]="hero" class="my-2"></app-hero>
<mat-divider></mat-divider>
</ng-container>
</section>
</div>
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions client/simple-web-site/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@import "material-theme";
@import 'color';

@tailwind base;
@tailwind components;
@tailwind utilities;

@import 'color';

html,
body {
margin: 0;
}

.active {
background: $my-blue;
background: $my-blue !important;
}
4 changes: 2 additions & 2 deletions tailwind.config.js → client/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['client/simple-web-site/src/**/*.{html,ts}'],
content: ['./**/*.{html,ts,js}'],
theme: {
extend: {
screens: {
Expand All @@ -15,5 +15,5 @@ module.exports = {
},
},
plugins: [],
important: true,
important: false,
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"test:playwright": "npx playwright test"
},
"lint-staged": {
"*.{js,ts,css,scss,html,md}": [
"{client,server}*.{js,ts,css,scss,html,md}": [
"eslint --fix"
]
},
Expand Down Expand Up @@ -121,7 +121,6 @@
"ajv": "^8.12.0",
"allure-commandline": "^2.29.0",
"allure-playwright": "^3.0.0-beta.5",
"autoprefixer": "^10.4.20",
"commitizen": "^4.3.0",
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
Expand All @@ -143,12 +142,13 @@
"lint-staged": "^15.2.10",
"mongoose": "^8.9.2",
"nyc": "^15.1.0",
"postcss": "^8.4.49",
"prettier": "^3.4.2",
"reflect-metadata": "^0.2.0",
"rxjs": "^7.8.1",
"standard-version": "^9.5.0",
"tailwindcss": "^3.4.16",
"tailwindcss": "^3.4.17",
"postcss": "^8.4.49",
"autoprefixer": "^10.4.20",
"three": "^0.165.0",
"tslib": "^2.3.0",
"typescript": "~5.5.4",
Expand Down
1 change: 1 addition & 0 deletions server/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ENV_NAME=development
DATABASE_PROTOCOL=mongodb://
DATABASE_HOST=localhost:27017/
DATABASE_NAME=test
PORT=3000
1 change: 1 addition & 0 deletions server/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ ENV_NAME=production
DATABASE_PROTOCOL=mongodb://
DATABASE_HOST=localhost:27017/
DATABASE_NAME=test
PORT=3001
4 changes: 4 additions & 0 deletions server/nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"include": "../.env.production",
"outDir": "../build/.env"
},
{
"include": "./assets/*",
"outDir": "../build"
},
{
"include": "../package.json",
"outDir": "../build/package.json"
Expand Down
3 changes: 2 additions & 1 deletion server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as Joi from 'joi';

import { AppController } from 'src/app.controller';
import { AppService } from 'src/app.service';
import { EsService } from 'src/es/es.service';
import { HeroesModule } from 'src/heroes/heroes.module';

const ENV = process.env.NODE_ENV;
Expand Down Expand Up @@ -53,6 +54,6 @@ const ENV = process.env.NODE_ENV;
HeroesModule,
],
controllers: [AppController],
providers: [AppService],
providers: [AppService, EsService],
})
export class AppModule {}
50 changes: 50 additions & 0 deletions server/src/assets/heroes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
"squadName": "Super hero squad",
"homeTown": "Metro City",
"formed": 2016,
"secretBase": "Super tower",
"active": true,
"members": [
{
"name": "Molecule Man",
"age": 29,
"secretIdentity": "Dan Jukes",
"powers": [
"Radiation resistance",
"Turning tiny",
"Radiation blast"
]
},
{
"name": "Madame Uppercut",
"age": 39,
"secretIdentity": "Jane Wilson",
"powers": [
"Million tonne punch",
"Damage resistance",
"Superhuman reflexes"
]
},
{
"name": "Eternal Flame",
"age": 1000000,
"secretIdentity": "Unknown",
"powers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdimensional travel"
]
}
]
},
{
"squadName": "Lonely Super hero",
"homeTown": "Lonely City",
"formed": 2025,
"secretBase": "Lonely tower",
"active": false
}
]
3 changes: 3 additions & 0 deletions server/src/assets/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"description": "this file is for testing nestJS build process, which should output this file to build/assets folder"
}
Loading

0 comments on commit 5e5956e

Please sign in to comment.