refac: move domain to <module>
This commit is contained in:
parent
7e723cd0d4
commit
18eda9bb5d
19 changed files with 15 additions and 31 deletions
|
@ -1,5 +1,5 @@
|
||||||
import type { Contact } from "@/domain/entities/contact";
|
|
||||||
import type { BaseCreateApiPort } from "@/shared/lib/ports";
|
import type { BaseCreateApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { Contact } from "../domain";
|
||||||
|
|
||||||
export interface ContactFormApiCreateProps {
|
export interface ContactFormApiCreateProps {
|
||||||
email: string;
|
email: string;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Contact } from "@/domain/entities/contact";
|
|
||||||
import type { EntityId } from "@/shared/lib/entity";
|
import type { EntityId } from "@/shared/lib/entity";
|
||||||
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { Contact } from "../domain";
|
||||||
|
|
||||||
export interface ContactsTableApiFetchManyProps {
|
export interface ContactsTableApiFetchManyProps {
|
||||||
listId?: EntityId;
|
listId?: EntityId;
|
||||||
|
|
1
src/app/contacts/domain/index.ts
Normal file
1
src/app/contacts/domain/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export type { Contact } from "./contact";
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Contact } from "@/domain/entities/contact";
|
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import type { Contact } from "./domain";
|
||||||
|
|
||||||
export const useContactsStore = defineStore("contacts", () => {
|
export const useContactsStore = defineStore("contacts", () => {
|
||||||
const data = ref([] as Contact[]);
|
const data = ref([] as Contact[]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AppFile } from "@/domain/entities/file";
|
|
||||||
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { AppFile } from "../domain";
|
||||||
|
|
||||||
export type FilesTableApiPort = BaseFetchManyApiPort<AppFile>;
|
export type FilesTableApiPort = BaseFetchManyApiPort<AppFile>;
|
||||||
|
|
1
src/app/files/domain/index.ts
Normal file
1
src/app/files/domain/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export type { AppFile } from "./file";
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AppFile } from "@/domain/entities/file";
|
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import type { AppFile } from "./domain";
|
||||||
|
|
||||||
export const useFilesStore = defineStore("files", () => {
|
export const useFilesStore = defineStore("files", () => {
|
||||||
const data = ref([] as AppFile[]);
|
const data = ref([] as AppFile[]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { List } from "@/domain/entities/list";
|
|
||||||
import type { BaseCreateApiPort } from "@/shared/lib/ports";
|
import type { BaseCreateApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { List } from "../domain";
|
||||||
|
|
||||||
export interface ListFormApiCreateProps {
|
export interface ListFormApiCreateProps {
|
||||||
displayName: string;
|
displayName: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { List } from "@/domain/entities/list";
|
|
||||||
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { List } from "../domain";
|
||||||
|
|
||||||
export type ListsSelectApiPort = BaseFetchManyApiPort<List>;
|
export type ListsSelectApiPort = BaseFetchManyApiPort<List>;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { List } from "@/domain/entities/list";
|
|
||||||
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
import type { BaseFetchManyApiPort } from "@/shared/lib/ports";
|
||||||
|
import type { List } from "../domain";
|
||||||
|
|
||||||
export type ListsTableApiPort = BaseFetchManyApiPort<List>;
|
export type ListsTableApiPort = BaseFetchManyApiPort<List>;
|
||||||
|
|
1
src/app/lists/domain/index.ts
Normal file
1
src/app/lists/domain/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export type { List } from "./list";
|
|
@ -1,6 +1,6 @@
|
||||||
import type { List } from "@/domain/entities/list";
|
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import type { List } from "./domain";
|
||||||
|
|
||||||
export const useListsStore = defineStore("lists", () => {
|
export const useListsStore = defineStore("lists", () => {
|
||||||
const data = ref([] as List[]);
|
const data = ref([] as List[]);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type {
|
||||||
ContactFormApiCreateProps,
|
ContactFormApiCreateProps,
|
||||||
ContactsTableApiFetchManyProps,
|
ContactsTableApiFetchManyProps,
|
||||||
} from "@/app/contacts";
|
} from "@/app/contacts";
|
||||||
import type { Contact } from "@/domain/entities/contact";
|
import type { Contact } from "@/app/contacts/domain";
|
||||||
import type { EntityId } from "@/shared/lib/entity";
|
import type { EntityId } from "@/shared/lib/entity";
|
||||||
import { delay } from "@/shared/lib/utils/promise";
|
import { delay } from "@/shared/lib/utils/promise";
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { FileApiPort } from "@/app/files";
|
import type { FileApiPort } from "@/app/files";
|
||||||
import type { AppFile } from "@/domain/entities/file";
|
import type { AppFile } from "@/app/files/domain";
|
||||||
import { delay } from "@/shared/lib/utils/promise";
|
import { delay } from "@/shared/lib/utils/promise";
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { ListApiPort, ListFormApiCreateProps } from "@/app/lists";
|
import type { ListApiPort, ListFormApiCreateProps } from "@/app/lists";
|
||||||
import type { List } from "@/domain/entities/list";
|
import type { List } from "@/app/lists/domain";
|
||||||
import { delay } from "@/shared/lib/utils/promise";
|
import { delay } from "@/shared/lib/utils/promise";
|
||||||
import { faker } from "@faker-js/faker";
|
import { faker } from "@faker-js/faker";
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { faker } from "@faker-js/faker";
|
|
||||||
|
|
||||||
export class MockTemplateApi implements TemplateApiPort {
|
|
||||||
#templates: Template[];
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.#templates = Array.from(new Array(20).keys()).map((_) => {
|
|
||||||
const id = faker.datatype.uuid();
|
|
||||||
const displayName = faker.lorem.words(3);
|
|
||||||
const createdAt = faker.date.birthdate();
|
|
||||||
return { id, displayName, createdAt };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetchMany(): Promise<Template[]> {
|
|
||||||
await delay(1000);
|
|
||||||
return this.#templates.concat();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue