Compare commits

..

2 Commits

Author SHA1 Message Date
049c52485f Merge remote-tracking branch 'origin/master'
All checks were successful
continuous-integration/drone/push Build is passing
2022-10-29 04:18:58 +10:00
5d93130970 added Timestamp Feature 2022-10-29 04:18:21 +10:00
13 changed files with 2111 additions and 86 deletions

View File

@ -1,6 +1,10 @@
{ {
"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,7 +18,12 @@
"@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"
}, },
@ -27,6 +32,7 @@
"@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,6 +3,7 @@ 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';
@ -12,6 +13,7 @@ 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 },
@ -36,7 +38,10 @@ const appRoutes: Routes = [
HttpClientModule, HttpClientModule,
FormsModule FormsModule
], ],
providers: [ApiChatService], providers: [
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.Date}}</h3> <h3>{{post.Timestamp}}</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 {
Date: string Timestamp: string
Id: number Id: number
Text: string Text: string

View File

@ -4,4 +4,6 @@
<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,5 +1,6 @@
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',
@ -8,13 +9,16 @@ import { ApiChatService } from '../services/api-chat.service';
}) })
export class SendPostComponent implements OnInit { export class SendPostComponent implements OnInit {
constructor(public apiChatService: ApiChatService) { constructor(public apiChatService: ApiChatService, public minIoService: MinIoService) {
} }
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,17 +12,19 @@ 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 =
{ {
Date: Date, Timestamp: text,
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

@ -0,0 +1,25 @@
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

@ -0,0 +1,16 @@
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();
});
});