Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Xicheng Guo committed Jan 10, 2024
1 parent fa20e19 commit 3674312
Show file tree
Hide file tree
Showing 37 changed files with 334 additions and 334 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiny-crud",
"version": "1.0.20",
"version": "1.0.21",
"description": "",
"main": "dist/bundle.cjs.js",
"module": "dist/bundle.esm.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "dayjs";
import { BookModel } from "./helper/book-model";
import { Book } from "./helper/book-storage";
import { PlainObject } from "../storage-lib";
import { Book } from "./helper/book-repository";
import { PlainObject } from "../repository-lib";

describe('Test Book Storage', () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PlainObject } from "../storage-lib";
import { PlainObject } from "../repository-lib";
import { ChatModel } from "./helper/chat-model";
import { Chat } from "./helper/chat-storage";
import { Chat } from "./helper/chat-repository";

describe('Use Gitlab Test Chat Storage', () => {

Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/helper/book-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BaseModel } from "../../storage-lib";

import { BaseModel } from '../../repository-lib/';
export interface BookModel extends BaseModel {
book_name: string;
book_author: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GithubStorage } from "../../storage-lib";
import { GithubRepository } from "../../repository-lib";
import { SingletonFactory } from "../../utils";
import { BookModel } from "./book-model";
import { githubRequest } from "./helper";

class BookStorage extends GithubStorage<BookModel> {
class BookRepository extends GithubRepository<BookModel> {
constructor() {
super(githubRequest);
}
Expand All @@ -12,4 +12,4 @@ class BookStorage extends GithubStorage<BookModel> {
/**
* test github api with a book storage instance.
*/
export const Book = SingletonFactory.createInstance(BookStorage);
export const Book = SingletonFactory.createInstance(BookRepository);
2 changes: 1 addition & 1 deletion src/__tests__/helper/chat-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseModel } from "../../storage-lib";
import { BaseModel } from "../../repository-lib";

export interface ChatModel extends BaseModel {
participants: string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GitlabStorage } from "../../storage-lib";
import { GitlabRepository } from "../../repository-lib";
import { ChatModel } from "./chat-model";
import { GITLAB_NUMBER, gitlabRequest } from "./helper";
import { SingletonFactory } from "../../utils";

class ChatStorage extends GitlabStorage<ChatModel> {
class ChatRepository extends GitlabRepository<ChatModel> {
constructor() {
super(gitlabRequest, GITLAB_NUMBER);
}
Expand All @@ -12,4 +12,4 @@ class ChatStorage extends GitlabStorage<ChatModel> {
/**
* test gitlab api with a chat storage instance.
*/
export const Chat = SingletonFactory.createInstance(ChatStorage);
export const Chat = SingletonFactory.createInstance(ChatRepository);
2 changes: 1 addition & 1 deletion src/__tests__/helper/user-model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseModel } from "../..";
import { BaseModel } from "../../repository-lib";
export interface UserModel extends BaseModel {
name: string;
age: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { GiteeStorage } from '../..';

import { GiteeRepository } from '../../repository-lib';
import { SingletonFactory } from '../../utils';
import { GITEE_NUMBER, giteeRequest } from './helper';
import { UserModel } from './user-model';

export class UserStorage extends GiteeStorage<UserModel> {
export class UserRepository extends GiteeRepository<UserModel> {
constructor() {
super(giteeRequest, GITEE_NUMBER);
}
Expand All @@ -12,4 +13,4 @@ export class UserStorage extends GiteeStorage<UserModel> {
/**
* test gitee api with a user storage instance.
*/
export const User = SingletonFactory.createInstance(UserStorage);
export const User = SingletonFactory.createInstance(UserRepository);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PlainObject } from "../storage-lib";
import { PlainObject } from "../repository-lib";
import { UserModel } from "./helper/user-model";
import { User } from "./helper/user-storage";
import { User } from "./helper/user-repository";
import dayjs from 'dayjs';

describe('Test User Storage', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createRequest } from "./request-lib/create-request";
import { BaseModel, GiteeStorage, GithubStorage, GitlabStorage, PlainObject } from "./storage-lib";
import { BaseModel, GiteeRepository, GitlabRepository, GithubRepository, PlainObject } from "./repository-lib";
import { SingletonFactory } from "./utils"
export {
createRequest, BaseModel, PlainObject,
GiteeStorage, GithubStorage, GitlabStorage, SingletonFactory
GiteeRepository, GitlabRepository, GithubRepository, SingletonFactory
};

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Author } from "./author";
export interface BaseModel {
id: number;
updated_at: string;
created_at: string;
created_by: Author;
import { Author } from "./author";
export interface BaseModel {
id: number;
updated_at: string;
created_at: string;
created_by: Author;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GiteeParams } from "../gitee/gitee-params";
import { GithubParams } from "../github/github-params";
import { GitlabParams } from "../gitlab/gitlab-params";

import { GiteeParams } from "../gitee/gitee-params";
import { GithubParams } from "../github/github-params";
import { GitlabParams } from "../gitlab/gitlab-params";

export type BaseParams = GiteeParams | GithubParams | GitlabParams;
Loading

0 comments on commit 3674312

Please sign in to comment.