@citrineos/data
Version:
The OCPP data module which includes all persistence layer implementation.
21 lines (20 loc) • 1.25 kB
TypeScript
import { Sequelize } from 'sequelize-typescript';
import { SequelizeRepository, Subscription } from '../index.js';
import type { ISubscriptionRepository } from '../../../index.js';
import type { BootstrapConfig } from '@citrineos/base';
import type { ILogObj } from 'tslog';
import { Logger } from 'tslog';
export declare class SequelizeSubscriptionRepository extends SequelizeRepository<Subscription> implements ISubscriptionRepository {
constructor(config: BootstrapConfig, logger?: Logger<ILogObj>, sequelizeInstance?: Sequelize);
/**
* Creates a new {@link Subscription} in the database.
* Input is assumed to not have an id, and id will be removed if present.
* Object is rebuilt to ensure access to essential {@link Model} function {@link Model.save()} (Model is extended by Subscription).
*
* @param value {@link Subscription} object which may have been deserialized from JSON
* @returns Saved {@link Subscription} if successful, undefined otherwise
*/
create(tenantId: number, value: Subscription): Promise<Subscription>;
readAllByStationId(tenantId: number, stationId: string): Promise<Subscription[]>;
deleteByKey(tenantId: number, key: string): Promise<Subscription | undefined>;
}