init to pos domain

This commit is contained in:
2026-03-18 13:35:57 +03:30
parent f2766e2d7d
commit 1e2f94261e
42 changed files with 635 additions and 809 deletions
@@ -0,0 +1,6 @@
const baseUrl = '/api/v1/pos';
export const POS_API_ROUTES = {
info: () => `${baseUrl}`,
goods: () => `${baseUrl}/goods`,
};
@@ -0,0 +1 @@
export * from './apiRoutes';
@@ -0,0 +1,13 @@
import { TAccountType } from '@/core/constants/accountTypes.const';
export interface IAccountRawResponse {
username: string;
id: string;
}
export interface IAccountResponse extends IAccountRawResponse {}
export interface IAccountRequest {
username: string;
password?: string;
type: TAccountType;
}
@@ -0,0 +1,2 @@
export * from './accounts_io';
export * from './io';
+18
View File
@@ -0,0 +1,18 @@
import { TRoles } from '@/core';
export interface IUserRawResponse {
mobile_number: string;
first_name: string;
last_name: string;
fullname: string;
id: string;
role: TRoles;
}
export interface IUserResponse extends IUserRawResponse {}
export interface IUserRequest {
first_name: string;
last_name: string;
mobile_number: string;
role: TRoles;
}
@@ -0,0 +1,20 @@
import { IPosInfoRawResponse, IPosInfoResponse } from '@/domains/pos/models/pos.io';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { POS_API_ROUTES } from '../constants';
import { IUserRawResponse, IUserResponse } from '../models';
@Injectable({ providedIn: 'root' })
export class PosService {
constructor(private http: HttpClient) {}
private apiRoutes = POS_API_ROUTES;
getInfo(): Observable<IPosInfoResponse> {
return this.http.get<IPosInfoRawResponse>(this.apiRoutes.info());
}
getGoods(): Observable<IUserResponse> {
return this.http.get<IUserRawResponse>(this.apiRoutes.goods());
}
}
@@ -0,0 +1 @@
export * from './root.component';
@@ -0,0 +1 @@
<span>صفحه‌ی pos</span>
@@ -0,0 +1,21 @@
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
import { PosStore } from '@/domains/pos/pos.store';
import { LayoutService } from '@/layout/service/layout.service';
import { Component, computed, inject } from '@angular/core';
@Component({
selector: 'pos-landing',
templateUrl: './root.component.html',
})
export class PosLandingComponent {
private readonly store = inject(PosStore);
private readonly layoutService = inject(LayoutService);
private readonly posInfo = computed(() => this.store.entity());
ngOnInit() {
this.layoutService.setPanelInfo({
title: `فروشگاه ${this.posInfo()?.complex.name} - ${this.posInfo()?.name}`,
});
}
}