fac-shared-db 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +66 -0
  2. package/build/connection.d.ts +9 -0
  3. package/build/connection.js +13 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +2 -0
  6. package/build/models/AcaoMarcada.d.ts +38 -0
  7. package/build/models/AcaoMarcada.js +18 -0
  8. package/build/models/AcoesConfig.d.ts +32 -0
  9. package/build/models/AcoesConfig.js +33 -0
  10. package/build/models/Advertencia.d.ts +44 -0
  11. package/build/models/Advertencia.js +20 -0
  12. package/build/models/AntiGrabberConfig.d.ts +24 -0
  13. package/build/models/AntiGrabberConfig.js +9 -0
  14. package/build/models/BindsRoupaConfig.d.ts +29 -0
  15. package/build/models/BindsRoupaConfig.js +21 -0
  16. package/build/models/Blacklist.d.ts +16 -0
  17. package/build/models/Blacklist.js +10 -0
  18. package/build/models/BotConfig.d.ts +72 -0
  19. package/build/models/BotConfig.js +66 -0
  20. package/build/models/Caixa2Item.d.ts +14 -0
  21. package/build/models/Caixa2Item.js +8 -0
  22. package/build/models/CanalConfig.d.ts +19 -0
  23. package/build/models/CanalConfig.js +9 -0
  24. package/build/models/CargoConfig.d.ts +18 -0
  25. package/build/models/CargoConfig.js +12 -0
  26. package/build/models/CraftConfig.d.ts +41 -0
  27. package/build/models/CraftConfig.js +31 -0
  28. package/build/models/Farm.d.ts +23 -0
  29. package/build/models/Farm.js +19 -0
  30. package/build/models/FarmValidacaoState.d.ts +48 -0
  31. package/build/models/FarmValidacaoState.js +31 -0
  32. package/build/models/FeatureTogglesConfig.d.ts +17 -0
  33. package/build/models/FeatureTogglesConfig.js +6 -0
  34. package/build/models/History.d.ts +14 -0
  35. package/build/models/History.js +7 -0
  36. package/build/models/KeyValue.d.ts +13 -0
  37. package/build/models/KeyValue.js +6 -0
  38. package/build/models/MembroCadastro.d.ts +16 -0
  39. package/build/models/MembroCadastro.js +9 -0
  40. package/build/models/MensagemRecrutamento.d.ts +15 -0
  41. package/build/models/MensagemRecrutamento.js +9 -0
  42. package/build/models/MensagemRotacao.d.ts +18 -0
  43. package/build/models/MensagemRotacao.js +11 -0
  44. package/build/models/RegistroOlheiro.d.ts +33 -0
  45. package/build/models/RegistroOlheiro.js +19 -0
  46. package/build/models/UpRegistro.d.ts +20 -0
  47. package/build/models/UpRegistro.js +10 -0
  48. package/build/models/Venda.d.ts +21 -0
  49. package/build/models/Venda.js +13 -0
  50. package/build/models/VendaConfig.d.ts +23 -0
  51. package/build/models/VendaConfig.js +13 -0
  52. package/build/models/index.d.ts +46 -0
  53. package/build/models/index.js +23 -0
  54. package/package.json +28 -0
@@ -0,0 +1,41 @@
1
+ import mongoose, { type Document } from "mongoose";
2
+ /**
3
+ * Configuração de Craft (peso máximo de mochila + receitas).
4
+ * Extraído de BotConfig — uso Singleton via configId fixo ("main").
5
+ */
6
+ export interface ICraftConfig extends Document {
7
+ configId: string;
8
+ /** Peso máximo da mochila em kg */
9
+ pesoMaxMochila: number;
10
+ /** Receitas de craft por tipo de munição (pesos, receitas de carga/munição, tempos) */
11
+ craftReceitas: {
12
+ tipo: string;
13
+ pesos: {
14
+ polvora: number;
15
+ cartucho: number;
16
+ projetil: number;
17
+ municao: number;
18
+ };
19
+ receitaCarga: {
20
+ polvora: number;
21
+ cartucho: number;
22
+ produz: number;
23
+ };
24
+ receitaMunicao: {
25
+ projetil: number;
26
+ carga: number;
27
+ produz: number;
28
+ };
29
+ tempoCraft: {
30
+ carga: number;
31
+ municao: number;
32
+ };
33
+ }[];
34
+ }
35
+ export declare const CraftConfigModel: mongoose.Model<ICraftConfig, {}, {}, {}, mongoose.Document<unknown, {}, ICraftConfig, {}, mongoose.DefaultSchemaOptions> & ICraftConfig & Required<{
36
+ _id: mongoose.Types.ObjectId;
37
+ }> & {
38
+ __v: number;
39
+ } & {
40
+ id: string;
41
+ }, any, ICraftConfig>;
@@ -0,0 +1,31 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const CraftConfigSchema = new Schema({
3
+ configId: { type: String, default: "main", unique: true },
4
+ pesoMaxMochila: { type: Number, default: 150 },
5
+ craftReceitas: {
6
+ type: [{
7
+ tipo: { type: String, required: true },
8
+ pesos: {
9
+ polvora: { type: Number, required: true },
10
+ cartucho: { type: Number, required: true },
11
+ projetil: { type: Number, required: true },
12
+ municao: { type: Number, required: true },
13
+ },
14
+ receitaCarga: {
15
+ polvora: { type: Number, required: true },
16
+ cartucho: { type: Number, required: true },
17
+ produz: { type: Number, required: true },
18
+ },
19
+ receitaMunicao: {
20
+ projetil: { type: Number, required: true },
21
+ carga: { type: Number, required: true },
22
+ produz: { type: Number, required: true },
23
+ },
24
+ tempoCraft: {
25
+ carga: { type: Number, required: true },
26
+ municao: { type: Number, required: true },
27
+ },
28
+ }],
29
+ },
30
+ });
31
+ export const CraftConfigModel = mongoose.model("CraftConfig", CraftConfigSchema);
@@ -0,0 +1,23 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ export interface IFarm extends Document {
3
+ odiscordId: string;
4
+ nomeInGame: string;
5
+ idInGame: string;
6
+ cargo: string;
7
+ dataEntrega: string;
8
+ dataVencimento: string;
9
+ registradoPor: string;
10
+ status: "ativo" | "vencido" | "entregue";
11
+ cargoAnterior?: string;
12
+ cargosAnterioresIds?: string[];
13
+ rebaixado?: boolean;
14
+ notificadoDmVencimento?: boolean;
15
+ manual?: boolean;
16
+ }
17
+ export declare const FarmModel: mongoose.Model<IFarm, {}, {}, {}, mongoose.Document<unknown, {}, IFarm, {}, mongoose.DefaultSchemaOptions> & IFarm & Required<{
18
+ _id: mongoose.Types.ObjectId;
19
+ }> & {
20
+ __v: number;
21
+ } & {
22
+ id: string;
23
+ }, any, IFarm>;
@@ -0,0 +1,19 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const FarmSchema = new Schema({
3
+ odiscordId: { type: String, required: true, unique: true, index: true },
4
+ nomeInGame: { type: String, required: true },
5
+ idInGame: { type: String, required: true, index: true },
6
+ cargo: { type: String, required: true },
7
+ dataEntrega: { type: String, required: true },
8
+ dataVencimento: { type: String, required: true, index: true },
9
+ registradoPor: { type: String, required: true },
10
+ status: { type: String, enum: ["ativo", "vencido", "entregue"], default: "ativo", index: true },
11
+ cargoAnterior: { type: String },
12
+ cargosAnterioresIds: { type: [String], default: undefined },
13
+ rebaixado: { type: Boolean, default: false },
14
+ notificadoDmVencimento: { type: Boolean, default: false },
15
+ manual: { type: Boolean, default: false, index: true },
16
+ }, { timestamps: true });
17
+ // Índice composto para consultas frequentes
18
+ FarmSchema.index({ status: 1, dataVencimento: 1 });
19
+ export const FarmModel = mongoose.model("Farm", FarmSchema);
@@ -0,0 +1,48 @@
1
+ import mongoose, { type Document } from "mongoose";
2
+ /**
3
+ * Estado persistido da validação de farm.
4
+ * Salvo no graceful shutdown, restaurado no startup.
5
+ * Um único documento com todo o estado serializado.
6
+ */
7
+ export interface IFarmPendenteDoc {
8
+ discordId: string;
9
+ idInGame: string;
10
+ registradorIdInGame: string | null;
11
+ tipoFarm: string;
12
+ itensDetectados: Array<{
13
+ nomeItem: string;
14
+ quantidade: number;
15
+ acao: string;
16
+ }>;
17
+ mensagemOriginal: string;
18
+ mensagemUrl: string;
19
+ criadoEm: number;
20
+ guildId: string;
21
+ channelId: string;
22
+ messageId: string;
23
+ vezes: number;
24
+ reducaoMeta?: number;
25
+ }
26
+ export interface IItemOrfaoDoc {
27
+ idInGame: string;
28
+ item: {
29
+ nomeItem: string;
30
+ quantidade: number;
31
+ acao: string;
32
+ };
33
+ idInGameOriginal: string;
34
+ timestamp: number;
35
+ }
36
+ export interface IFarmValidacaoState extends Document {
37
+ _key: "singleton";
38
+ farmsPendentes: IFarmPendenteDoc[];
39
+ bufferItensOrfaos: IItemOrfaoDoc[];
40
+ salvoEm: Date;
41
+ }
42
+ export declare const FarmValidacaoStateModel: mongoose.Model<IFarmValidacaoState, {}, {}, {}, mongoose.Document<unknown, {}, IFarmValidacaoState, {}, mongoose.DefaultSchemaOptions> & IFarmValidacaoState & Required<{
43
+ _id: mongoose.Types.ObjectId;
44
+ }> & {
45
+ __v: number;
46
+ } & {
47
+ id: string;
48
+ }, any, IFarmValidacaoState>;
@@ -0,0 +1,31 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const FarmPendenteSchema = new Schema({
3
+ discordId: String,
4
+ idInGame: String,
5
+ registradorIdInGame: { type: String, default: null },
6
+ tipoFarm: String,
7
+ itensDetectados: [{ nomeItem: String, quantidade: Number, acao: String }],
8
+ mensagemOriginal: String,
9
+ mensagemUrl: String,
10
+ criadoEm: Number,
11
+ guildId: String,
12
+ channelId: String,
13
+ messageId: String,
14
+ vezes: Number,
15
+ reducaoMeta: { type: Number, default: 0 },
16
+ }, { _id: false });
17
+ const ItemOrfaoSchema = new Schema({
18
+ idInGame: String,
19
+ item: { nomeItem: String, quantidade: Number, acao: String },
20
+ idInGameOriginal: String,
21
+ timestamp: Number,
22
+ }, { _id: false });
23
+ const FarmValidacaoStateSchema = new Schema({
24
+ _key: { type: String, default: "singleton", unique: true },
25
+ farmsPendentes: [FarmPendenteSchema],
26
+ bufferItensOrfaos: [ItemOrfaoSchema],
27
+ salvoEm: { type: Date, default: Date.now },
28
+ }, { timestamps: false });
29
+ // TTL: auto-delete após 10 minutos (segurança, caso bot não restaure)
30
+ FarmValidacaoStateSchema.index({ salvoEm: 1 }, { expireAfterSeconds: 600 });
31
+ export const FarmValidacaoStateModel = mongoose.model("FarmValidacaoState", FarmValidacaoStateSchema);
@@ -0,0 +1,17 @@
1
+ import mongoose, { type Document } from "mongoose";
2
+ /**
3
+ * Overrides de feature toggles (sobrescreve .env quando definido).
4
+ * Extraído de BotConfig — uso Singleton via configId fixo ("main").
5
+ */
6
+ export interface IFeatureTogglesConfig extends Document {
7
+ configId: string;
8
+ /** Override de feature toggles via MongoDB (sobrescreve .env quando definido) */
9
+ toggles: Map<string, boolean>;
10
+ }
11
+ export declare const FeatureTogglesConfigModel: mongoose.Model<IFeatureTogglesConfig, {}, {}, {}, mongoose.Document<unknown, {}, IFeatureTogglesConfig, {}, mongoose.DefaultSchemaOptions> & IFeatureTogglesConfig & Required<{
12
+ _id: mongoose.Types.ObjectId;
13
+ }> & {
14
+ __v: number;
15
+ } & {
16
+ id: string;
17
+ }, any, IFeatureTogglesConfig>;
@@ -0,0 +1,6 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const FeatureTogglesConfigSchema = new Schema({
3
+ configId: { type: String, default: "main", unique: true },
4
+ toggles: { type: Map, of: Boolean, default: new Map() },
5
+ });
6
+ export const FeatureTogglesConfigModel = mongoose.model("FeatureTogglesConfig", FeatureTogglesConfigSchema);
@@ -0,0 +1,14 @@
1
+ import mongoose from "mongoose";
2
+ /** Histórico append-only genérico, extraído do core/database.ts do real-street-rp. */
3
+ export interface IHistory {
4
+ collection: string;
5
+ data: unknown;
6
+ createdAt: Date;
7
+ }
8
+ export declare const HistoryModel: mongoose.Model<IHistory, {}, {}, {}, mongoose.Document<unknown, {}, IHistory, {}, mongoose.DefaultSchemaOptions> & IHistory & {
9
+ _id: mongoose.Types.ObjectId;
10
+ } & {
11
+ __v: number;
12
+ } & {
13
+ id: string;
14
+ }, any, IHistory>;
@@ -0,0 +1,7 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const HistorySchema = new Schema({
3
+ collection: { type: String, required: true, index: true },
4
+ data: { type: Schema.Types.Mixed, required: true },
5
+ createdAt: { type: Date, default: Date.now },
6
+ }, { suppressReservedKeysWarning: true });
7
+ export const HistoryModel = mongoose.model("History", HistorySchema);
@@ -0,0 +1,13 @@
1
+ import mongoose from "mongoose";
2
+ /** Schema genérico para dados simples (key-value), extraído do core/database.ts do real-street-rp. */
3
+ export interface IKeyValue {
4
+ key: string;
5
+ value: unknown;
6
+ }
7
+ export declare const KeyValueModel: mongoose.Model<IKeyValue, {}, {}, {}, mongoose.Document<unknown, {}, IKeyValue, {}, mongoose.DefaultSchemaOptions> & IKeyValue & {
8
+ _id: mongoose.Types.ObjectId;
9
+ } & {
10
+ __v: number;
11
+ } & {
12
+ id: string;
13
+ }, any, IKeyValue>;
@@ -0,0 +1,6 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const KeyValueSchema = new Schema({
3
+ key: { type: String, required: true, unique: true },
4
+ value: { type: Schema.Types.Mixed, required: true },
5
+ }, { timestamps: true });
6
+ export const KeyValueModel = mongoose.model("KeyValue", KeyValueSchema);
@@ -0,0 +1,16 @@
1
+ export interface IMembroCadastro {
2
+ /** Discord ID do membro */
3
+ _id: string;
4
+ nomeInGame: string;
5
+ idInGame: string;
6
+ /** Discord ID de quem cadastrou/editou pela última vez */
7
+ atualizadoPor: string;
8
+ atualizadoEm: Date;
9
+ }
10
+ export declare const MembroCadastroModel: import("mongoose").Model<IMembroCadastro, {}, {}, {}, import("mongoose").Document<unknown, {}, IMembroCadastro, {}, import("mongoose").DefaultSchemaOptions> & IMembroCadastro & Required<{
11
+ _id: string;
12
+ }> & {
13
+ __v: number;
14
+ } & {
15
+ id: string;
16
+ }, any, IMembroCadastro>;
@@ -0,0 +1,9 @@
1
+ import { Schema, model } from "mongoose";
2
+ const MembroCadastroSchema = new Schema({
3
+ _id: { type: String },
4
+ nomeInGame: { type: String, required: true },
5
+ idInGame: { type: String, required: true },
6
+ atualizadoPor: { type: String, default: "" },
7
+ atualizadoEm: { type: Date, default: Date.now },
8
+ }, { timestamps: false, versionKey: false });
9
+ export const MembroCadastroModel = model("MembroCadastro", MembroCadastroSchema);
@@ -0,0 +1,15 @@
1
+ export interface IMensagemRecrutamento {
2
+ /** Chave fixa do documento (singleton) */
3
+ _id: string;
4
+ conteudo: string;
5
+ autorId: string;
6
+ mensagemId: string;
7
+ atualizadoEm: Date;
8
+ }
9
+ export declare const MensagemRecrutamentoModel: import("mongoose").Model<IMensagemRecrutamento, {}, {}, {}, import("mongoose").Document<unknown, {}, IMensagemRecrutamento, {}, import("mongoose").DefaultSchemaOptions> & IMensagemRecrutamento & Required<{
10
+ _id: string;
11
+ }> & {
12
+ __v: number;
13
+ } & {
14
+ id: string;
15
+ }, any, IMensagemRecrutamento>;
@@ -0,0 +1,9 @@
1
+ import { Schema, model } from "mongoose";
2
+ const MensagemRecrutamentoSchema = new Schema({
3
+ _id: { type: String },
4
+ conteudo: { type: String, default: "" },
5
+ autorId: { type: String, default: "" },
6
+ mensagemId: { type: String, default: "" },
7
+ atualizadoEm: { type: Date, default: Date.now },
8
+ }, { timestamps: false, versionKey: false });
9
+ export const MensagemRecrutamentoModel = model("MensagemRecrutamento", MensagemRecrutamentoSchema);
@@ -0,0 +1,18 @@
1
+ import mongoose, { type Document } from "mongoose";
2
+ export interface IMensagemRotacao extends Document {
3
+ _id: mongoose.Types.ObjectId;
4
+ nome: string;
5
+ descricao: string;
6
+ cor: number;
7
+ textoAntes: string;
8
+ ativa: boolean;
9
+ ultimoEnvio: Date | null;
10
+ criadaEm: Date;
11
+ }
12
+ export declare const MensagemRotacaoModel: mongoose.Model<IMensagemRotacao, {}, {}, {}, mongoose.Document<unknown, {}, IMensagemRotacao, {}, mongoose.DefaultSchemaOptions> & IMensagemRotacao & Required<{
13
+ _id: mongoose.Types.ObjectId;
14
+ }> & {
15
+ __v: number;
16
+ } & {
17
+ id: string;
18
+ }, any, IMensagemRotacao>;
@@ -0,0 +1,11 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const MensagemRotacaoSchema = new Schema({
3
+ nome: { type: String, required: true, unique: true, trim: true },
4
+ descricao: { type: String, required: true },
5
+ cor: { type: Number, default: 0x5865f2 },
6
+ textoAntes: { type: String, default: "||@here||" },
7
+ ativa: { type: Boolean, default: true },
8
+ ultimoEnvio: { type: Date, default: null },
9
+ criadaEm: { type: Date, default: Date.now },
10
+ });
11
+ export const MensagemRotacaoModel = mongoose.model("MensagemRotacao", MensagemRotacaoSchema);
@@ -0,0 +1,33 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ export interface IRegistroOlheiro extends Document {
3
+ /** Discord ID do olheiro registrado */
4
+ olheiroId: string;
5
+ /** Nome in-game do olheiro (Primeiro Sobrenome) */
6
+ nomeInGame: string;
7
+ /** ID in-game numérico */
8
+ idInGame: string;
9
+ /** Telefone in-game (removido) */
10
+ /** Discord ID do recrutador que recrutou */
11
+ recrutadorId: string;
12
+ /** Nome in-game do recrutador (apenas nome, sem cargo/sigla) */
13
+ recrutadorNome: string;
14
+ /** ID in-game do recrutador */
15
+ recrutadorIdInGame: string;
16
+ /** Cargo do recrutador no momento do registro */
17
+ recrutadorCargo?: string;
18
+ /** Status do registro */
19
+ status: "pendente" | "aprovado" | "reprovado" | "invalidado";
20
+ /** ID da mensagem de aprovação no canal */
21
+ mensagemId?: string;
22
+ /** Data da avaliação */
23
+ avaliadoEm?: Date;
24
+ /** Motivo da finalização — preenchido em status reprovado ou invalidado */
25
+ motivoFinalizacao?: string;
26
+ }
27
+ export declare const RegistroOlheiroModel: mongoose.Model<IRegistroOlheiro, {}, {}, {}, mongoose.Document<unknown, {}, IRegistroOlheiro, {}, mongoose.DefaultSchemaOptions> & IRegistroOlheiro & Required<{
28
+ _id: mongoose.Types.ObjectId;
29
+ }> & {
30
+ __v: number;
31
+ } & {
32
+ id: string;
33
+ }, any, IRegistroOlheiro>;
@@ -0,0 +1,19 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const RegistroOlheiroSchema = new Schema({
3
+ olheiroId: { type: String, required: true, index: true },
4
+ nomeInGame: { type: String, required: true },
5
+ idInGame: { type: String, required: true },
6
+ recrutadorId: { type: String, required: true, index: true },
7
+ recrutadorNome: { type: String, required: true },
8
+ recrutadorIdInGame: { type: String, required: true },
9
+ recrutadorCargo: { type: String },
10
+ status: { type: String, enum: ["pendente", "aprovado", "reprovado", "invalidado"], default: "pendente", index: true },
11
+ mensagemId: { type: String },
12
+ avaliadoEm: { type: Date },
13
+ motivoFinalizacao: { type: String },
14
+ }, { timestamps: true });
15
+ // Índice para consultas de status por recrutador
16
+ RegistroOlheiroSchema.index({ recrutadorId: 1, status: 1 });
17
+ // Índice para consultas de ranking/contagem por status + avaliadoEm
18
+ RegistroOlheiroSchema.index({ status: 1, avaliadoEm: 1 });
19
+ export const RegistroOlheiroModel = mongoose.model("RegistroOlheiro", RegistroOlheiroSchema);
@@ -0,0 +1,20 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ export interface IUpRegistro extends Document {
3
+ /** Discord ID do solicitante (gerente que pediu o UP) */
4
+ solicitanteId: string;
5
+ /** Discord ID do membro promovido */
6
+ membroId: string;
7
+ /** ID do cargo para o qual foi promovido */
8
+ cargoSolicitadoId: string;
9
+ /** Discord ID de quem aprovou o UP */
10
+ aprovadoPorId?: string;
11
+ /** Data da aprovação */
12
+ aprovadoEm: Date;
13
+ }
14
+ export declare const UpRegistroModel: mongoose.Model<IUpRegistro, {}, {}, {}, mongoose.Document<unknown, {}, IUpRegistro, {}, mongoose.DefaultSchemaOptions> & IUpRegistro & Required<{
15
+ _id: mongoose.Types.ObjectId;
16
+ }> & {
17
+ __v: number;
18
+ } & {
19
+ id: string;
20
+ }, any, IUpRegistro>;
@@ -0,0 +1,10 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const UpRegistroSchema = new Schema({
3
+ solicitanteId: { type: String, required: true, index: true },
4
+ membroId: { type: String, required: true },
5
+ cargoSolicitadoId: { type: String, required: true },
6
+ aprovadoPorId: { type: String, index: true },
7
+ aprovadoEm: { type: Date, default: Date.now, index: true },
8
+ });
9
+ UpRegistroSchema.index({ solicitanteId: 1, aprovadoEm: 1 });
10
+ export const UpRegistroModel = mongoose.model("UpRegistro", UpRegistroSchema);
@@ -0,0 +1,21 @@
1
+ import mongoose, { Document } from "mongoose";
2
+ export interface IVenda extends Document {
3
+ /** Discord ID de quem registrou a venda */
4
+ vendedorId: string;
5
+ /** Tipo do item vendido (pistola/smg/fuzil) */
6
+ item: string;
7
+ quantidade: number;
8
+ comParceria: boolean;
9
+ precoUnitario: number;
10
+ total: number;
11
+ comissaoPercentual: number;
12
+ comissaoValor: number;
13
+ criadoEm: Date;
14
+ }
15
+ export declare const VendaModel: mongoose.Model<IVenda, {}, {}, {}, mongoose.Document<unknown, {}, IVenda, {}, mongoose.DefaultSchemaOptions> & IVenda & Required<{
16
+ _id: mongoose.Types.ObjectId;
17
+ }> & {
18
+ __v: number;
19
+ } & {
20
+ id: string;
21
+ }, any, IVenda>;
@@ -0,0 +1,13 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const VendaSchema = new Schema({
3
+ vendedorId: { type: String, required: true, index: true },
4
+ item: { type: String, required: true },
5
+ quantidade: { type: Number, required: true },
6
+ comParceria: { type: Boolean, required: true },
7
+ precoUnitario: { type: Number, required: true },
8
+ total: { type: Number, required: true },
9
+ comissaoPercentual: { type: Number, required: true },
10
+ comissaoValor: { type: Number, required: true },
11
+ criadoEm: { type: Date, default: Date.now, index: true },
12
+ });
13
+ export const VendaModel = mongoose.model("Venda", VendaSchema);
@@ -0,0 +1,23 @@
1
+ import mongoose, { type Document } from "mongoose";
2
+ /**
3
+ * Configuração de Vendas (preços + comissão).
4
+ * Extraído de BotConfig — uso Singleton via configId fixo ("main").
5
+ */
6
+ export interface IVendaConfig extends Document {
7
+ configId: string;
8
+ /** Preços por tipo de munição (chave → {comParceria, semParceria}) */
9
+ precosVenda: {
10
+ tipo: string;
11
+ comParceria: number;
12
+ semParceria: number;
13
+ }[];
14
+ /** Percentual de comissão pago ao vendedor sobre o total de cada venda */
15
+ comissaoVendaPercentual: number;
16
+ }
17
+ export declare const VendaConfigModel: mongoose.Model<IVendaConfig, {}, {}, {}, mongoose.Document<unknown, {}, IVendaConfig, {}, mongoose.DefaultSchemaOptions> & IVendaConfig & Required<{
18
+ _id: mongoose.Types.ObjectId;
19
+ }> & {
20
+ __v: number;
21
+ } & {
22
+ id: string;
23
+ }, any, IVendaConfig>;
@@ -0,0 +1,13 @@
1
+ import mongoose, { Schema } from "mongoose";
2
+ const VendaConfigSchema = new Schema({
3
+ configId: { type: String, default: "main", unique: true },
4
+ precosVenda: {
5
+ type: [{
6
+ tipo: { type: String, required: true },
7
+ comParceria: { type: Number, required: true },
8
+ semParceria: { type: Number, required: true },
9
+ }],
10
+ },
11
+ comissaoVendaPercentual: { type: Number, default: 5 },
12
+ });
13
+ export const VendaConfigModel = mongoose.model("VendaConfig", VendaConfigSchema);
@@ -0,0 +1,46 @@
1
+ export { AcaoMarcadaModel } from "./AcaoMarcada.js";
2
+ export type { IAcaoMarcada } from "./AcaoMarcada.js";
3
+ export { AcoesConfigModel } from "./AcoesConfig.js";
4
+ export type { IAcoesConfig } from "./AcoesConfig.js";
5
+ export { AdvertenciaModel } from "./Advertencia.js";
6
+ export type { IAdvertencia, TipoAdvertencia } from "./Advertencia.js";
7
+ export { AntiGrabberConfigModel } from "./AntiGrabberConfig.js";
8
+ export type { IAntiGrabberConfig } from "./AntiGrabberConfig.js";
9
+ export { BindsRoupaConfigModel } from "./BindsRoupaConfig.js";
10
+ export type { IBindsRoupaConfig } from "./BindsRoupaConfig.js";
11
+ export { BlacklistModel } from "./Blacklist.js";
12
+ export type { IBlacklist } from "./Blacklist.js";
13
+ export { BotConfigModel } from "./BotConfig.js";
14
+ export type { CargoHierarchyConfigEntry, IBotConfig } from "./BotConfig.js";
15
+ export { Caixa2ItemModel } from "./Caixa2Item.js";
16
+ export type { ICaixa2Item } from "./Caixa2Item.js";
17
+ export { CanalConfigModel } from "./CanalConfig.js";
18
+ export type { ICanalConfig } from "./CanalConfig.js";
19
+ export { CargoConfigModel } from "./CargoConfig.js";
20
+ export type { ICargoConfig } from "./CargoConfig.js";
21
+ export { CraftConfigModel } from "./CraftConfig.js";
22
+ export type { ICraftConfig } from "./CraftConfig.js";
23
+ export { FarmModel } from "./Farm.js";
24
+ export type { IFarm } from "./Farm.js";
25
+ export { FarmValidacaoStateModel } from "./FarmValidacaoState.js";
26
+ export type { IFarmPendenteDoc, IFarmValidacaoState, IItemOrfaoDoc } from "./FarmValidacaoState.js";
27
+ export { FeatureTogglesConfigModel } from "./FeatureTogglesConfig.js";
28
+ export type { IFeatureTogglesConfig } from "./FeatureTogglesConfig.js";
29
+ export { MembroCadastroModel } from "./MembroCadastro.js";
30
+ export type { IMembroCadastro } from "./MembroCadastro.js";
31
+ export { MensagemRecrutamentoModel } from "./MensagemRecrutamento.js";
32
+ export type { IMensagemRecrutamento } from "./MensagemRecrutamento.js";
33
+ export { MensagemRotacaoModel } from "./MensagemRotacao.js";
34
+ export type { IMensagemRotacao } from "./MensagemRotacao.js";
35
+ export { RegistroOlheiroModel } from "./RegistroOlheiro.js";
36
+ export type { IRegistroOlheiro } from "./RegistroOlheiro.js";
37
+ export { UpRegistroModel } from "./UpRegistro.js";
38
+ export type { IUpRegistro } from "./UpRegistro.js";
39
+ export { VendaModel } from "./Venda.js";
40
+ export type { IVenda } from "./Venda.js";
41
+ export { VendaConfigModel } from "./VendaConfig.js";
42
+ export type { IVendaConfig } from "./VendaConfig.js";
43
+ export { KeyValueModel } from "./KeyValue.js";
44
+ export type { IKeyValue } from "./KeyValue.js";
45
+ export { HistoryModel } from "./History.js";
46
+ export type { IHistory } from "./History.js";
@@ -0,0 +1,23 @@
1
+ export { AcaoMarcadaModel } from "./AcaoMarcada.js";
2
+ export { AcoesConfigModel } from "./AcoesConfig.js";
3
+ export { AdvertenciaModel } from "./Advertencia.js";
4
+ export { AntiGrabberConfigModel } from "./AntiGrabberConfig.js";
5
+ export { BindsRoupaConfigModel } from "./BindsRoupaConfig.js";
6
+ export { BlacklistModel } from "./Blacklist.js";
7
+ export { BotConfigModel } from "./BotConfig.js";
8
+ export { Caixa2ItemModel } from "./Caixa2Item.js";
9
+ export { CanalConfigModel } from "./CanalConfig.js";
10
+ export { CargoConfigModel } from "./CargoConfig.js";
11
+ export { CraftConfigModel } from "./CraftConfig.js";
12
+ export { FarmModel } from "./Farm.js";
13
+ export { FarmValidacaoStateModel } from "./FarmValidacaoState.js";
14
+ export { FeatureTogglesConfigModel } from "./FeatureTogglesConfig.js";
15
+ export { MembroCadastroModel } from "./MembroCadastro.js";
16
+ export { MensagemRecrutamentoModel } from "./MensagemRecrutamento.js";
17
+ export { MensagemRotacaoModel } from "./MensagemRotacao.js";
18
+ export { RegistroOlheiroModel } from "./RegistroOlheiro.js";
19
+ export { UpRegistroModel } from "./UpRegistro.js";
20
+ export { VendaModel } from "./Venda.js";
21
+ export { VendaConfigModel } from "./VendaConfig.js";
22
+ export { KeyValueModel } from "./KeyValue.js";
23
+ export { HistoryModel } from "./History.js";
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "fac-shared-db",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./build/index.d.ts",
10
+ "default": "./build/index.js"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "check": "tsc --noEmit && echo ✔ Ok",
15
+ "build": "node -e \"require('fs').rmSync('build',{recursive:true,force:true})\" && tsc",
16
+ "prepare": "npm run build"
17
+ },
18
+ "files": [
19
+ "build"
20
+ ],
21
+ "dependencies": {
22
+ "mongoose": "^9.1.1"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "22.16.4",
26
+ "typescript": "5.9.3"
27
+ }
28
+ }