Share AimeId typedef
This commit is contained in:
+1
-1
@@ -1,9 +1,9 @@
|
||||
import { PoolClient } from "pg";
|
||||
import * as sql from "sql-bricks";
|
||||
|
||||
import { AimeId } from "./model";
|
||||
import { CardRepository, Transaction } from "./repo";
|
||||
import { connect, generateId, generateExtId } from "../db";
|
||||
import { AimeId } from "../model";
|
||||
|
||||
class CardRepositoryImpl implements CardRepository {
|
||||
constructor(private readonly _conn: PoolClient) {}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { AimeId } from "./model";
|
||||
import { AimeId } from "../model";
|
||||
|
||||
export interface CardRepository {
|
||||
lookup(luid: string, now: Date): Promise<AimeId | undefined>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AimeId } from "./model";
|
||||
import { AimeId } from "../model";
|
||||
|
||||
export type RegisterLevel = "none" | "portal" | "segaid";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { AimeId } from "../model/base";
|
||||
import { DiscoverProfileRequest } from "../request/discoverProfile";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
discoverProfile.msgCode = 0x006b as RequestCode;
|
||||
discoverProfile.msgLen = 0x0010;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { AimeId } from "../model/base";
|
||||
import { LoadProfileRequest } from "../request/loadProfile";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
loadProfile.msgCode = 0x0067 as RequestCode;
|
||||
loadProfile.msgLen = 0x0020;
|
||||
|
||||
@@ -3,8 +3,9 @@ import { promisify } from "util";
|
||||
|
||||
import { loadJson, saveJson } from "./_util";
|
||||
import { ProfileRepository } from "../repo";
|
||||
import { AimeId, Id } from "../model/base";
|
||||
import { Id } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
const exists = promisify(fs.exists);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Quasi-nominative "brands". These double-underscore properties never actually
|
||||
// exist at run time, we just pretend they do.
|
||||
|
||||
export type AimeId = number & { __brand: "aimeId" };
|
||||
export type BackgroundCode = number & { __brand: "backgroundCode" };
|
||||
export type Id<T> = number & { __id: T };
|
||||
export type TitleCode = number & { __brand: "titleCode" };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { AimeId, BackgroundCode, Id, TitleCode } from "./base";
|
||||
export { BackgroundCode, Id, TitleCode } from "./base";
|
||||
export { Car, CarSelector } from "./car";
|
||||
export { Chara } from "./chara";
|
||||
export { MissionState, MissionGrid } from "./mission";
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
import * as Model from "./model";
|
||||
import { AimeId } from "../model";
|
||||
|
||||
export interface CarRepository {
|
||||
countCars(profileId: Model.Id<Model.Profile>): Promise<number>;
|
||||
@@ -40,9 +41,9 @@ export interface ProfileRepository {
|
||||
// Might want to come up with something better here
|
||||
generateId(): Promise<Model.Id<Model.Profile>>;
|
||||
|
||||
discoverByAimeId(id: Model.AimeId): Promise<boolean>;
|
||||
discoverByAimeId(id: AimeId): Promise<boolean>;
|
||||
|
||||
loadByAimeId(id: Model.AimeId): Promise<Model.Profile>;
|
||||
loadByAimeId(id: AimeId): Promise<Model.Profile>;
|
||||
|
||||
load(id: Model.Id<Model.Profile>): Promise<Model.Profile>;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AimeId } from "../model";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
export interface DiscoverProfileRequest {
|
||||
type: "discover_profile_req";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AimeId } from "../model/base";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
export interface LoadProfileRequest {
|
||||
type: "load_profile_req";
|
||||
|
||||
Reference in New Issue
Block a user