added Timestamp Feature

This commit is contained in:
RakVhalate 2022-10-22 22:45:51 +10:00
parent 4f8765840a
commit 5d93130970
13 changed files with 2112 additions and 87 deletions

View File

@ -1,6 +1,10 @@
{
"ExpandedNodes": [
""
"",
"\\src",
"\\src\\app",
"\\src\\app\\boards",
"\\src\\app\\services"
],
"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-dynamic": "^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",
"stream": "^0.0.2",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
@ -27,6 +32,7 @@
"@angular/cli": "~14.2.6",
"@angular/compiler-cli": "^14.2.0",
"@types/jasmine": "~4.0.0",
"@types/minio": "^7.0.14",
"jasmine-core": "~4.3.0",
"karma": "~6.4.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 { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
@ -12,6 +13,7 @@ import { ApiChatService } from './services/api-chat.service';
import { FormsModule } from '@angular/forms';
import { SendPostComponent } from './send-post/send-post.component';
import { PostComponent } from './boards/post/post.component'
import { MinIoService } from "./services/min-io.service.";
const appRoutes: Routes = [
{ path: '', component: HomeComponent },
@ -36,7 +38,10 @@ const appRoutes: Routes = [
HttpClientModule,
FormsModule
],
providers: [ApiChatService],
providers: [
ApiChatService,
MinIoService
],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -1,5 +1,5 @@
<div class="post">
<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>
</div>

View File

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

View File

@ -1,7 +1,9 @@
<div class="send_post">
<h4>Поведай миру что-нибудь хорошее.</h4>
<input type="text" size="60" placeholder="Печатать сюда" #textToPost>
<textarea type="text" rows="8" cols="45" placeholder="Печатать сюда" #textToPost> </textarea>
<p>
<button (click)="sendPost(textToPost.value)">Отправить</button>
</p>
<h1>Загрузить картинку:</h1>
<input type="file" (change)="sendPic($event)">
</div>

View File

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

View File

@ -12,17 +12,19 @@ export class ApiChatService {
getPosts(): Observable<SinglePost[]> {
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) {
console.log("Отправляю пост...");
var postToSend =
{
Date: Date,
Timestamp: text,
Id: 0,
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();
});
});