@test137e29b/module-hrp-database-types
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -29,2 +29,3 @@ /// <reference types="mongoose/types/types" /> | ||
import { Schema, Types } from 'mongoose'; | ||
import { TLocationWithHeading } from '../..'; | ||
import { CharacterClothing, CharacterFaceFeatures, CharacterHair, CharacterHeadBlend, CharacterHeadOverlay } from './Character.types'; | ||
@@ -35,7 +36,14 @@ export declare const characterSchema: Schema; | ||
accountIdentifier: string; | ||
faceFeatures: CharacterFaceFeatures; | ||
headBlend: CharacterHeadBlend; | ||
headOverlays: CharacterHeadOverlay; | ||
clothing: CharacterClothing; | ||
hair: CharacterHair; | ||
firstName: string; | ||
lastName: string; | ||
dateOfBirth: Date; | ||
model: string; | ||
gender: string; | ||
faceFeatures?: CharacterFaceFeatures; | ||
headBlend?: CharacterHeadBlend; | ||
headOverlays?: CharacterHeadOverlay; | ||
clothing?: CharacterClothing; | ||
eyeColor?: number; | ||
hair?: CharacterHair; | ||
position: TLocationWithHeading; | ||
} | ||
@@ -45,8 +53,15 @@ export declare abstract class ClientCharacter implements ClientEntity<DBCharacter> { | ||
accountIdentifier: string; | ||
headOverlays: CharacterHeadOverlay; | ||
faceFeatures: CharacterFaceFeatures; | ||
headBlend: CharacterHeadBlend; | ||
clothing: CharacterClothing; | ||
hair: CharacterHair; | ||
firstName: string; | ||
lastName: string; | ||
dateOfBirth: string; | ||
model: string; | ||
gender: string; | ||
faceFeatures?: CharacterFaceFeatures; | ||
headBlend?: CharacterHeadBlend; | ||
headOverlays?: CharacterHeadOverlay; | ||
clothing?: CharacterClothing; | ||
eyeColor?: number; | ||
hair?: CharacterHair; | ||
position: TLocationWithHeading; | ||
} | ||
export declare function toClientCharacter(db: DBCharacter): ClientCharacter; |
@@ -9,8 +9,17 @@ "use strict"; | ||
lastName: { type: String, required: true }, | ||
dateOfBirth: { type: Date, required: true }, | ||
model: { type: String, required: true }, | ||
faceFeatures: { type: mongoose_1.Schema.Types.Mixed, required: true }, | ||
headBlend: { type: mongoose_1.Schema.Types.Mixed, required: true }, | ||
headOverlays: { type: mongoose_1.Schema.Types.Mixed, required: true }, | ||
clothing: { type: mongoose_1.Schema.Types.Mixed, required: true } | ||
}, { timestamps: true }).index({ accountIdentifier: 1 }, { background: true }); | ||
gender: { type: String, required: true }, | ||
faceFeatures: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
headBlend: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
headOverlays: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
clothing: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
eyeColor: { type: Number, required: false }, | ||
hair: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
position: { type: mongoose_1.Schema.Types.Mixed, required: false }, | ||
dimension: { type: Number, default: 0 }, | ||
lastLogin: { type: Date, default: Date.now } | ||
}, { timestamps: true }) | ||
.index({ accountIdentifier: 1 }, { background: true }) | ||
.index({ firstName: 1, lastName: 1 }, { background: true, unique: true }); | ||
class DBCharacter { | ||
@@ -26,7 +35,14 @@ } | ||
accountIdentifier: db.accountIdentifier, | ||
headOverlays: db.headOverlays, | ||
firstName: db.firstName, | ||
lastName: db.lastName, | ||
dateOfBirth: db.dateOfBirth.toISOString(), | ||
model: db.model, | ||
gender: db.gender, | ||
faceFeatures: db.faceFeatures, | ||
headBlend: db.headBlend, | ||
headOverlays: db.headOverlays, | ||
clothing: db.clothing, | ||
hair: db.hair | ||
eyeColor: db.eyeColor, | ||
hair: db.hair, | ||
position: db.position | ||
}; | ||
@@ -33,0 +49,0 @@ } |
@@ -8,3 +8,3 @@ "use strict"; | ||
constructor(connection) { | ||
super(connection, CharacterRepository.COLLECTION_NAME, Character_model_1.characterSchema, Character_model_1.toClientCharacter); | ||
super(connection, CharacterRepository.COLLECTION_NAME, Character_model_1.characterSchema); | ||
} | ||
@@ -11,0 +11,0 @@ } |
@@ -39,3 +39,2 @@ /** | ||
thirdMix: number; | ||
isParent: boolean; | ||
}; | ||
@@ -48,5 +47,4 @@ /** | ||
opacity: number; | ||
colorType: number; | ||
color: number; | ||
secondColor: number; | ||
color?: number; | ||
secondColor?: number; | ||
}; | ||
@@ -65,2 +63,4 @@ export type CharacterHeadOverlay = { | ||
chestHair: CharacterHeadOverlayData; | ||
bodyBlemishes: CharacterHeadOverlayData; | ||
addBodyBlemishes: CharacterHeadOverlayData; | ||
}; | ||
@@ -67,0 +67,0 @@ /** |
import { DBCharacter } from './entities/Character/Character.model'; | ||
import { CharacterRepository } from './entities/Character/Character.repository'; | ||
export type TLocation = { | ||
x: number; | ||
y: number; | ||
z: number; | ||
}; | ||
export type TLocationWithHeading = TLocation & { | ||
heading: number; | ||
}; | ||
export type RepositoryClass = (typeof REPOSITORY_CONFIG)[number]; | ||
export declare const REPOSITORY_CONFIG: (typeof CharacterRepository)[]; | ||
export declare const characterRepository: import("@test137e29b/fm-mongoose-repository").ExportedRepository<DBCharacter, import("@test137e29b/fm-mongoose-repository/dist/repository/types").ClientEntity<DBCharacter>, Partial<Omit<import("@test137e29b/fm-mongoose-repository/dist/repository/types").ClientEntity<DBCharacter>, "_id" | "createdAt" | "updatedAt">>>; | ||
export declare const characterRepository: import("@test137e29b/fm-mongoose-repository").ExportedRepository<DBCharacter, Partial<Omit<DBCharacter, "_id" | "createdAt" | "updatedAt">>>; |
import { ExportedRepository } from '@test137e29b/fm-mongoose-repository/dist'; | ||
import { EmptyObject, IRepoKey } from '@test137e29b/fm-mongoose-repository/dist/repository/types'; | ||
import { RepositoryClass } from '../index'; | ||
export declare function wrapExportedRepository<Entity extends IRepoKey & EmptyObject>(repoClass: RepositoryClass): ExportedRepository<Entity, import("@test137e29b/fm-mongoose-repository/dist/repository/types").ClientEntity<Entity>, Partial<Omit<import("@test137e29b/fm-mongoose-repository/dist/repository/types").ClientEntity<Entity>, "_id" | "createdAt" | "updatedAt">>>; | ||
export declare function wrapExportedRepository<Entity extends IRepoKey & EmptyObject>(repoClass: RepositoryClass): ExportedRepository<Entity, Partial<Omit<Entity, "_id" | "createdAt" | "updatedAt">>>; |
{ | ||
"name": "@test137e29b/module-hrp-database-types", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Database Types and Exported Repository Wrappers for HorizonRP on FiveM.", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"publishConfig": { | ||
@@ -20,3 +21,3 @@ "access": "public" | ||
"dependencies": { | ||
"@test137e29b/fm-mongoose-repository": "1.0.5", | ||
"@test137e29b/fm-mongoose-repository": "1.1.2", | ||
"mongoose": "8.6.0" | ||
@@ -23,0 +24,0 @@ }, |
import { ClientEntity } from '@test137e29b/fm-mongoose-repository/dist/repository/types'; | ||
import { Schema, Types } from 'mongoose'; | ||
import { TLocationWithHeading } from '../..'; | ||
import { CharacterClothing, CharacterFaceFeatures, CharacterHair, CharacterHeadBlend, CharacterHeadOverlay } from './Character.types'; | ||
@@ -10,10 +11,19 @@ | ||
lastName: { type: String, required: true }, | ||
dateOfBirth: { type: Date, required: true }, | ||
model: { type: String, required: true }, | ||
faceFeatures: { type: Schema.Types.Mixed, required: true }, | ||
headBlend: { type: Schema.Types.Mixed, required: true }, | ||
headOverlays: { type: Schema.Types.Mixed, required: true }, | ||
clothing: { type: Schema.Types.Mixed, required: true } | ||
gender: { type: String, required: true }, | ||
faceFeatures: { type: Schema.Types.Mixed, required: false }, | ||
headBlend: { type: Schema.Types.Mixed, required: false }, | ||
headOverlays: { type: Schema.Types.Mixed, required: false }, | ||
clothing: { type: Schema.Types.Mixed, required: false }, | ||
eyeColor: { type: Number, required: false }, | ||
hair: { type: Schema.Types.Mixed, required: false }, | ||
position: { type: Schema.Types.Mixed, required: false }, | ||
dimension: { type: Number, default: 0 }, | ||
lastLogin: { type: Date, default: Date.now } | ||
}, | ||
{ timestamps: true } | ||
).index({ accountIdentifier: 1 }, { background: true }); | ||
) | ||
.index({ accountIdentifier: 1 }, { background: true }) | ||
.index({ firstName: 1, lastName: 1 }, { background: true, unique: true }); | ||
@@ -23,7 +33,14 @@ export abstract class DBCharacter { | ||
accountIdentifier: string; | ||
faceFeatures: CharacterFaceFeatures; | ||
headBlend: CharacterHeadBlend; | ||
headOverlays: CharacterHeadOverlay; | ||
clothing: CharacterClothing; | ||
hair: CharacterHair; | ||
firstName: string; | ||
lastName: string; | ||
dateOfBirth: Date; | ||
model: string; // Player's Ped model, like mp_m_freemode_01, or a dog or some shit | ||
gender: string; // Anything the user desires, we're so progressive! | ||
faceFeatures?: CharacterFaceFeatures; | ||
headBlend?: CharacterHeadBlend; | ||
headOverlays?: CharacterHeadOverlay; | ||
clothing?: CharacterClothing; | ||
eyeColor?: number; | ||
hair?: CharacterHair; | ||
position: TLocationWithHeading | ||
} | ||
@@ -33,7 +50,14 @@ export abstract class ClientCharacter implements ClientEntity<DBCharacter> { | ||
accountIdentifier: string; | ||
headOverlays: CharacterHeadOverlay; | ||
faceFeatures: CharacterFaceFeatures | ||
headBlend: CharacterHeadBlend; | ||
clothing: CharacterClothing; | ||
hair: CharacterHair; | ||
firstName: string; | ||
lastName: string; | ||
dateOfBirth: string; | ||
model: string; | ||
gender: string; | ||
faceFeatures?: CharacterFaceFeatures | ||
headBlend?: CharacterHeadBlend; | ||
headOverlays?: CharacterHeadOverlay; | ||
clothing?: CharacterClothing; | ||
eyeColor?: number; | ||
hair?: CharacterHair; | ||
position: TLocationWithHeading; | ||
} | ||
@@ -44,8 +68,15 @@ export function toClientCharacter(db: DBCharacter): ClientCharacter { | ||
accountIdentifier: db.accountIdentifier, | ||
headOverlays: db.headOverlays, | ||
firstName: db.firstName, | ||
lastName: db.lastName, | ||
dateOfBirth: db.dateOfBirth.toISOString(), | ||
model: db.model, | ||
gender: db.gender, | ||
faceFeatures: db.faceFeatures, | ||
headBlend: db.headBlend, | ||
headOverlays: db.headOverlays, | ||
clothing: db.clothing, | ||
hair: db.hair | ||
eyeColor: db.eyeColor, | ||
hair: db.hair, | ||
position: db.position | ||
}; | ||
} |
import { MongoRepository } from '@test137e29b/fm-mongoose-repository/dist'; | ||
import { Connection } from 'mongoose'; | ||
import { DBCharacter, characterSchema, toClientCharacter } from './Character.model'; | ||
import { DBCharacter, characterSchema } from './Character.model'; | ||
@@ -8,4 +8,4 @@ export class CharacterRepository extends MongoRepository<DBCharacter> { | ||
constructor(connection: Connection) { | ||
super(connection, CharacterRepository.COLLECTION_NAME, characterSchema, toClientCharacter); | ||
super(connection, CharacterRepository.COLLECTION_NAME, characterSchema); | ||
} | ||
} |
@@ -40,3 +40,2 @@ /** | ||
thirdMix: number; | ||
isParent: boolean; | ||
}; | ||
@@ -50,5 +49,4 @@ | ||
opacity: number; | ||
colorType: number; | ||
color: number; | ||
secondColor: number; | ||
color?: number; | ||
secondColor?: number; | ||
}; | ||
@@ -68,2 +66,4 @@ | ||
chestHair: CharacterHeadOverlayData; | ||
bodyBlemishes: CharacterHeadOverlayData; | ||
addBodyBlemishes: CharacterHeadOverlayData; | ||
}; | ||
@@ -70,0 +70,0 @@ |
@@ -5,2 +5,5 @@ import { DBCharacter } from './entities/Character/Character.model'; | ||
export type TLocation = { x: number, y: number, z: number }; | ||
export type TLocationWithHeading = TLocation & { heading: number }; | ||
// Add to `REPOSITORY_CONFIG` array as the hrp-database module uses this array to initialize the repositories | ||
@@ -7,0 +10,0 @@ // into FiveM exports. They cannot be initialized here, or will exist in every single module's exports. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28888
646
+ Added@test137e29b/fm-mongoose-repository@1.1.2(transitive)
- Removed@test137e29b/fm-mongoose-repository@1.0.5(transitive)