Compare commits

..

No commits in common. "049c52485f183001182c79121de60e12fbfd0406" and "cda7e389080096389d27efa082cd5029f244ff9d" have entirely different histories.

13 changed files with 86 additions and 2111 deletions

View File

@ -1,10 +1,6 @@
{ {
"ExpandedNodes": [ "ExpandedNodes": [
"", ""
"\\src",
"\\src\\app",
"\\src\\app\\boards",
"\\src\\app\\services"
], ],
"PreviewInSolutionExplorer": false "PreviewInSolutionExplorer": false
} }

Binary file not shown.

2111
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,12 +18,7 @@
"@angular/platform-browser": "^14.2.0", "@angular/platform-browser": "^14.2.0",
"@angular/platform-browser-dynamic": "^14.2.0", "@angular/platform-browser-dynamic": "^14.2.0",
"@angular/router": "^14.2.0", "@angular/router": "^14.2.0",
"dotenv": "^16.0.3",
"minio": "^7.0.32",
"nestjs-minio-client": "^2.0.0",
"path": "^0.12.7",
"rxjs": "~7.5.0", "rxjs": "~7.5.0",
"stream": "^0.0.2",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
@ -32,7 +27,6 @@
"@angular/cli": "~14.2.6", "@angular/cli": "~14.2.6",
"@angular/compiler-cli": "^14.2.0", "@angular/compiler-cli": "^14.2.0",
"@types/jasmine": "~4.0.0", "@types/jasmine": "~4.0.0",
"@types/minio": "^7.0.14",
"jasmine-core": "~4.3.0", "jasmine-core": "~4.3.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0", "karma-chrome-launcher": "~3.1.0",

View File

@ -3,7 +3,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component'; import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component'; import { AboutComponent } from './about/about.component';
@ -13,7 +12,6 @@ import { ApiChatService } from './services/api-chat.service';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { SendPostComponent } from './send-post/send-post.component'; import { SendPostComponent } from './send-post/send-post.component';
import { PostComponent } from './boards/post/post.component' import { PostComponent } from './boards/post/post.component'
import { MinIoService } from "./services/min-io.service.";
const appRoutes: Routes = [ const appRoutes: Routes = [
{ path: '', component: HomeComponent }, { path: '', component: HomeComponent },
@ -38,10 +36,7 @@ const appRoutes: Routes = [
HttpClientModule, HttpClientModule,
FormsModule FormsModule
], ],
providers: [ providers: [ApiChatService],
ApiChatService,
MinIoService
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

View File

@ -1,5 +1,5 @@
<div class="post"> <div class="post">
<img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140"> # {{post.Id}} <img src="http://static.vdk2ch.ru:15555/test-public/оладий.jpg" alt="anonpls" width="140"> # {{post.Id}}
<h3>{{post.Timestamp}}</h3> <h3>{{post.Date}}</h3>
<h2>{{post.Text}}</h2> <h2>{{post.Text}}</h2>
</div> </div>

View File

@ -12,8 +12,8 @@ import { SinglePost } from '../../models/post';
export class PostComponent implements OnInit { export class PostComponent implements OnInit {
@Input() post: SinglePost @Input() post: SinglePost
ngOnInit(): void { ngOnInit(): void {
} }
} }

View File

@ -1,5 +1,5 @@
export interface SinglePost { export interface SinglePost {
Timestamp: string Date: string
Id: number Id: number
Text: string Text: string

View File

@ -4,6 +4,4 @@
<p> <p>
<button (click)="sendPost(textToPost.value)">Отправить</button> <button (click)="sendPost(textToPost.value)">Отправить</button>
</p> </p>
<h1>Загрузить картинку:</h1>
<input type="file" (change)="sendPic($event)">
</div> </div>

View File

@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ApiChatService } from '../services/api-chat.service'; import { ApiChatService } from '../services/api-chat.service';
import { MinIoService } from '../services/min-io.service.'
@Component({ @Component({
selector: 'app-send-post', selector: 'app-send-post',
@ -9,16 +8,13 @@ import { MinIoService } from '../services/min-io.service.'
}) })
export class SendPostComponent implements OnInit { export class SendPostComponent implements OnInit {
constructor(public apiChatService: ApiChatService, public minIoService: MinIoService) { constructor(public apiChatService: ApiChatService) {
} }
sendPost(text: string) { sendPost(text: string) {
this.apiChatService.sendPostToApi(text).subscribe(); this.apiChatService.sendPostToApi(text).subscribe();
} }
sendPic(event: any) {
this.minIoService.SendPicture(event);
}
ngOnInit(): void { ngOnInit(): void {
} }

View File

@ -12,19 +12,17 @@ export class ApiChatService {
getPosts(): Observable<SinglePost[]> { getPosts(): Observable<SinglePost[]> {
console.log("Получаю данные из сервиса"); console.log("Получаю данные из сервиса");
//return this.http.get<SinglePost[]>('http://api.vdk2ch.ru:5000/List/'); return this.http.get<SinglePost[]>('http://api.vdk2ch.ru:5000/List/');
return this.http.get<SinglePost[]>('http://localhost:7141/List/');
} }
sendPostToApi(text: string) { sendPostToApi(text: string) {
console.log("Отправляю пост..."); console.log("Отправляю пост...");
var postToSend = var postToSend =
{ {
Timestamp: text, Date: Date,
Id: 0, Id: 0,
Text: text Text: text
} }
//return this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend) return this.http.post('http://api.vdk2ch.ru:5000/PostTo', postToSend)
return this.http.post('http://localhost:7141/PostTo', postToSend)
} }
} }

View File

@ -1,25 +0,0 @@
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import * as Minio from 'minio';
@Injectable({
providedIn: 'root'
})
export class MinIoService {
picToSend = null;
constructor(private http: HttpClient) {
}
SendPicture(event: any): void {
console.log(event.target.files[0].name);
console.log('Отправляю картинку сервисом...');
}
}

View File

@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { MinIoService } from './min-io.service.';
describe('MinIoServiceService', () => {
let service: MinIoService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MinIoService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});